var xmlHttp

function checkForm(city, address, name, postalcode, msg) {

	if ( city == "" || address == "" || postalcode == "" ){
		alert(msg);
		return false;
	}
	else {
		return true;
	}
}

function str_replace(search, replace, subject, count) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Gabriel Paderni
    // +   improved by: Philip Peterson
    // +   improved by: Simon Willison (http://simonwillison.net)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   bugfixed by: Anton Ongson
    // +      input by: Onno Marsman
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    tweaked by: Onno Marsman
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   input by: Oleg Eremeev
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Oleg Eremeev
    // %          note 1: The count parameter must be passed as a string in order
    // %          note 1:  to find a global variable in which the result will be given
    // *     example 1: str_replace(' ', '.', 'Kevin van Zonneveld');
    // *     returns 1: 'Kevin.van.Zonneveld'
    // *     example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
    // *     returns 2: 'hemmo, mars'
 
    var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
            f = [].concat(search),
            r = [].concat(replace),
            s = subject,
            ra = r instanceof Array, sa = s instanceof Array;
    s = [].concat(s);
    if (count) {
        this.window[count] = 0;
    }
 
    for (i=0, sl=s.length; i < sl; i++) {
        if (s[i] === '') {
            continue;
        }
        for (j=0, fl=f.length; j < fl; j++) {
            temp = s[i]+'';
            repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
            s[i] = (temp).split(f[j]).join(repl);
            if (count && s[i] !== temp) {
                this.window[count] += (temp.length-s[i].length)/f[j].length;}
        }
    }
    return sa ? s : s[0];
}

function toggleDiv(div){
 if ($(div).style.display=='none') {
	$(div).style.display='block';
 }
 else {
	$(div).style.display='none';
}
}

function toggleSA(orderid){
var div = 'shippingAddress';
var divtitle = 'shippingAddressTitle';
var divprice = 'shippingPrice';
var divsum = 'sumPrice';
var divpersonalprice= 'personalPrice';
var personal = 0;

	 if ($(div).style.display=='none') {
		$(div).style.display='block';
		personal=0;
	 }
	 else {
		$(div).style.display='none';
		personal=1;
	}
	 if ($(divtitle).style.display=='none') {
		$(divtitle).style.display='inline';
	 }
	 else {
		$(divtitle).style.display='none';
	}
	 if ($(divprice).style.display=='none') {
		$(divprice).style.display='block';
	 }
	 else {
		$(divprice).style.display='none';
	}
	if ($(divsum).style.display=='none') {
		$(divsum).style.display='block';
	 }
	 else {
		$(divsum).style.display='none';
	}
	if ($(divpersonalprice).style.display=='none') {
		$(divpersonalprice).style.display='block';
	 }
	 else {
		$(divpersonalprice).style.display='none';
	}	
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }

	var url="ajax_personal.php"
	url=url+"?orderid="+orderid+"&personal="+personal
	
	//xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_SA()} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)	
}
function stateChangedOK_SA() 
{
var elementName="fav"+pid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
	$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function updateAddress(orderid, addressid, element)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }

	var url="ajax_update_address.php"
	url=url+"?orderid="+orderid+"&addressid="+addressid+"&element="+element

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_ADDRESS(element,orderid,0)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function trlProduct(productid, lang, to)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }

	var url="admin/ajax_product_translate.php"
	url=url+"?pid="+productid+"&language="+lang+"&to="+to

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_TRANSLATE_PRODUCT(productid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function toggleDiv2(div){
 if ($(div).style.display=='none') {
	$(div).blindDown({ duration: 1 })
 }
 else {
	$(div).blindUp({ duration: 1 })
}
}
 

function markOrder(orderid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/mark_order.php"
	url=url+"?orderid="+orderid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_ORDER(orderid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function catalogueFlag(pid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/catalogue_flag_ajax.php"
	url=url+"?pid="+pid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_CATALOGUE(pid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function ajandekFlag(pid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/ajax_ajandekkatalogus.php"
	url=url+"?pid="+pid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_AJANDEK(pid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function favouriteProduct(pid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/ajax_favourite.php"
	url=url+"?pid="+pid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_FAV(pid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function stateChangedOK_FAV(pid) 
{
var elementName="fav"+pid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
	$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function modCataloguePageNumber(pid, page)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/catalogue_flag_ajax.php"
	url=url+"?pid="+pid+"&mod="+page

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_PAGEMOD(pid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}


function trackOrder(orderid, trackid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/track_order.php"
	url=url+"?orderid="+orderid+"&trackid="+trackid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_TRACKING()} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function newAddress(city, address, name, postalcode, taxnumber, orderid, element)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }

	var url="ajax_update_address.php"
	name=str_replace('&','(_amp_)',name)
	city=str_replace('&','(_amp_)',city)
	address=str_replace('&','(_amp_)',address)
	
	url=url+"?city="+city+"&name="+name+"&address="+address+"&pcode="+postalcode+"&tax="+taxnumber+"&orderid="+orderid+"&element="+element
	url=encodeURI(url)
	
	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_ADDRESS(element,orderid,1)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function refreshAddress(orderid, element)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }

	var url="ajax_refresh_address.php"
	var ele;
	var elem;
	
	if (element=="shippingAddress") {
		ele = "billingAddress";
	}
	if (element=="billingAddress") {
		ele = "shippingAddress";
	}
	elem = ele+"Down"
	url=url+"?orderid="+orderid+"&element="+element
	
	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_UPDATE_ADDRESS(elem)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}


function emailOrder(orderid, userid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/send_confirmation.php"
	url=url+"?orderid="+orderid+"&userid="+userid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_EMAIL()} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function sendEmail(p, elem)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/ajax_email.php"
	var params = p;
//	url=url+"?orderid="+orderid+"&userid="+userid
	xmlHttp.open("POST", url, true);

	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
	xmlHttp.onreadystatechange = function stateChanged() {stateChangedOK_UPDATE_ADDRESS(elem)}
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params);
	
}


function archiveOrder(orderid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/archive_order.php"
	url=url+"?orderid="+orderid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_ARCHIVE(orderid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function addToQuicklist(pid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/ajax_quicklist.php"
	url=url+"?add=true&pid="+pid

	xmlHttp.onreadystatechange=function stateChanged() {stateChanged_QUICKLIST()} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function delFromQuicklist(pid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/ajax_quicklist.php"
	url=url+"?del=true&pid="+pid

	xmlHttp.onreadystatechange=function stateChanged() {stateChanged_QUICKLIST()} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function purgeQuicklist()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="admin/ajax_quicklist.php"
	url=url+"?purge=true"

	xmlHttp.onreadystatechange=function stateChanged() {stateChanged_QUICKLIST()} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function stateChanged_QUICKLIST() 
{
var elementName="quickList"
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
			$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function updateOrderStatus(orderid, statusid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 alert(orderid+' '+statusid);
	var url="admin/update_order_status.php"
	url=url+"?orderid="+orderid

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK_ORDER(orderid)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
}

function rateVideo(videoid, userid, ratenum)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="rate2.php"
url=url+"?vid="+videoid
url=url+"&userid="+userid
url=url+"&ratenum="+ratenum
xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK(videoid)} 
xmlHttp.open("GET",url,true)
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
xmlHttp.send(null)
}

function stateChangedOK(videoid) 
{
var elementName="txtHint"+videoid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
		$('ajaxLoader').style.display='none';	
 }
else if (xmlHttp.readyState<4)
 {
		$('ajaxLoader').style.display='block';
 }
 else {
		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_ADDRESS(element,orderid,itsnew) 
{
var elementName=element
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {  
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
	if (itsnew==1) {
		refreshAddress(orderid,element)
	}
			$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}
function stateChangedOK_UPDATE_ADDRESS(element) 
{
var elementName=element
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {  
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
			$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_ORDER(orderid) 
{
var elementName="order"+orderid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
		$('ajaxLoader').style.display='none';	
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_CATALOGUE(pid) 
{
var elementName="catalogue"+pid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
	$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_AJANDEK(pid) 
{
var elementName="ajandek"+pid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
	$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_TRANSLATE_PRODUCT(pid) 
{
var elementName="trl"+pid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
		$('ajaxLoader').style.display='none';	
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_PAGEMOD(pid) 
{
var elementName="catalogue"+pid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText;
		$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
		$('ajaxLoader').style.display='block'; 
 }
 else {
		$('ajaxLoader').style.display='block'; 
 }
}

function stateChangedOK_EMAIL() 
{
var elementName="email"
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText;
	$('ajaxLoader').style.display='none';	
 }
else if (xmlHttp.readyState<4)
 {
		$('ajaxLoader').style.display='block';
 }
 else {
		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_TRACKING() 
{
var elementName="tracking"
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
		$('ajaxLoader').style.display='none';	
 }
else if (xmlHttp.readyState<4)
 {
		$('ajaxLoader').style.display='block';
 }
 else {
		$('ajaxLoader').style.display='block';
 }
}

function stateChangedOK_ARCHIVE(orderid) 
{
var elementName="archive"+orderid
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
			$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}



function toggleCataloguePageNum(){
	if ( document.post.tocatalog[1].checked == true ) {
		$('cataloguePageNum').style.display='block';
	}
	else {
		$('cataloguePageNum').style.display='none';
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


	
	function setOnunload() {

		window.onbeforeunload = exitCheck;
        window.onunload = test;
		
	}
	

	
	function submitFormSkipOnunload() {
        window.onbeforeunload = function() {};
        window.onunload = test;
	}


        function test(){
        }
        function exitCheck(evt){
           return "Még nem küldted el az aktuális oldalt. Ha nem kívánsz menteni, kattints az OK gombra, ha menteni szeretnél a Mégse gombra. Mentéskor küldd el az űrlapot!";
        }
		
function loadPageAjax(page, div)
{ 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 
	var url=page;

	xmlHttp.onreadystatechange=function stateChanged() {stateChangedOK2(div)} 
	xmlHttp.open("GET",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8') 
	xmlHttp.send(null)
			
}	

function stateChangedOK2(element) 
{
var elementName=element
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {  
	document.getElementById(elementName).innerHTML=xmlHttp.responseText 
			$('ajaxLoader').style.display='none';
 }
else if (xmlHttp.readyState<4)
 {
 		$('ajaxLoader').style.display='block';
 }
 else {
 		$('ajaxLoader').style.display='block';
 }
}

	function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
     }
    }

	
function GetWidth()
{
        var x = 0;
        if (self.innerHeight)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
        }
        return x;
}
