function open_desc()
{
  document.getElementById("category_desc").style.display="";
	document.getElementById("add_img").style.display='none';
	 document.getElementById("delete_img").style.display="";
	
}

function close_desc()
{
   document.getElementById("category_desc").style.display='none';
	document.getElementById("delete_img").style.display='none';
   document.getElementById("add_img").style.display="";
}



function openwindow(val,uid,country,priid,companyname,seocompanyname)
{
	
	sendhitcount(uid,'4','','conjungo_gobrowse');
	if(val=='B'){
	//,"menubar=1,resizable=1,width=665,height=587,scrollbars=1"
		//var url="/vendors_suppliers/basic/"+seocompanyname+"/"+uid+"/"+priid+"/"+country
		var url="/vendors_suppliers/basic/"+seocompanyname+"/"+uid+"/"+priid;	
window.open(url,"_self");
	
create("basic_result.php",uid,'b',priid,companyname);
	}
	else if(val=='P'){

		var url="/vendors_suppliers/premier/"+seocompanyname+"/"+uid+"/"+priid;	
window.open(url,"_self");
	//,"menubar=1,resizable=1,width=665,height=600,scrollbars=1"

		//window.open("/premier_result.php?uid="+uid+"&country="+country+"&priid="+priid,"_self");
		create("premier_result.php",uid,'p',priid,companyname);
	}
}

function create(url,uid,type,priid,companyname){
	var httpRequest;
	var ex_div=document.getElementById("content");
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    	httpRequest = new XMLHttpRequest();
		http_Request = new XMLHttpRequest()
		httpRequest.overrideMimeType('text/xml');
	} else if (window.ActiveXObject) { // IE
    	httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		http_Request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(type=='b'){
		url=url+"?userid="+uid+"&seqno="+priid;
	}else
		url=url+"?uid="+uid+"&priid="+priid;
	
	httpRequest.open('GET', url, true);
	httpRequest.send(null);
	httpRequest.onreadystatechange = function(){
			if(httpRequest.readyState == 4){
				resp=httpRequest.responseText;
				http_Request.open("POST","model/page_cache.php",true)
				http_Request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				parameters= "content="+resp+"&id="+uid+"&companyname="+companyname;
				http_Request.setRequestHeader("Content-length", 4096);
				http_Request.send(parameters);
				//window.location="hello.html";  
			}
	};
}	

var xmlHttp
function state_select(str)
{ 
	
	var flg=0;
	for(var i =0; i<str.length ; i++)
	{
		if(str[i].selected==true)
		{
		// alert(str[i]);
		 flg++;
		 }
	}
    if(flg==1)
    {

		document.getElementById("county_adv").disabled=false;
		flg = 0;
	 	label_select(str.value);
		var url="/state.php"
		var url=url+"?q="+str.value+"&countryid="+this.country_id;
		xmlHttp=GetXmlHttpObject(FillComboCodeCat)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}  
	else
	{
	   document.getElementById("county_adv").disabled=true;
	}
} 
	 						
function FillComboCodeCat() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		 document.advsearch.county_adv.length=0;
         var county_array =xmlHttp.responseText.split(",");
		 var optionsIn = document.getElementById("county_adv");
		 for(var i=0;i<county_array.length-1;i++)
		 {
		 	
			optionsIn.options[optionsIn.length]= new Option(county_array[i],county_array[i]);
		 }
    }
}			

var xmlHttp1
function label_select(str)
{ 

	xmlHttp1=GetXmlHttpObject1()
	if (xmlHttp1==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="/label.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp1.onreadystatechange=stateChangedCat 
	var hi = xmlHttp1.open("GET",url,true)
	xmlHttp1.send(null)
} 
function stateChangedCat() 
{ 
	if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
	{ 

	    document.getElementById("lab_adv").innerHTML=xmlHttp1.responseText 
	} 	
} 
function right(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
		alert("Sorry, you do not have permission to right click.");
		return false;
	}
	return true;
}

function load_loc_con(){
	//var txtSelectedValuesObj = document.getElementById('country_multi');
	var selectedArray = new Array();
	var selObj = document.getElementById('country_multi');
	var i;
	var count = 0;
	for (i=0; i<selObj.options.length; i++) { 
		if (selObj.options[i].selected) {
			selectedArray[count] = selObj.options[i].value;
			count++;			
		}
	}
	if(selectedArray.length == 1){
		for (i=0; i<selObj.options.length; i++) { 
			if (selObj.options[i].selected) {
				selectedArray[count] = selObj.options[i].value;
				//count++; alert("test"+selObj.options[i].value);
				if(selObj.options[i].value == 'United Kingdom'){ 
					state_select(selObj);
				}
			}
		}
	}
	//state_select(document.getElementById('country_multi').options);
}



var currentElement;
var j;
j=0;
var divElements = document.getElementsByTagName('div');





var image = new Object();

function frmsubmit(mode)
{
	
	frm = document.advsearch;
	if(mode==2){
		val = frm.county_adv.value;
		if(frm.county_adv.disabled==true){
			var obj = frm.elements["coverage[]"];
			for(var i=0;i<obj.length;i++){
				if(obj[i].selected==true){
					val = obj[i].value;
					 if(val=='United Kingdom - England' || val=='United Kingdom - Wales' || val=='United Kingdom - Northern Ireland' || val=='United Kingdom - Scotland'){
						alert("Please select a County under "+val);
						return false;
					}
				}
			}
		}
		else if(val=='United Kingdom - England' || val=='United Kingdom - Wales' || val=='United Kingdom - Northern Ireland' || val=='United Kingdom - Scotland'){
					alert("Please select a County under "+val);
					return false;
		}
	}
	frm.submit();
}




var i = 0;
// Set up the image files to be used.
var logoImages = new Array() // do not change this
var classname = new Array();
var buttonImages = new Array()
var classnameHome = new Array();
var footerImages =  new Array();
// To add more image files, continue with the pattern below, adding to the array.
for (i=0;i<9;i++)
{
 logoImages[i] = "images/logo_" + (i+1) + ".jpg"
// buttonImages[i] = "images/go_advanced" + (i+1) + ".jpg"
// footerImages[i] = "images/logo_footer" + (i+1) + ".jpg"
 //classnameHome[i] = "link" + (i+1);
 //classname[i] = "link" + (i+1) + " vertidots";
 classname[i] = "link" + (i+1);
}
 
var p = logoImages.length
var image_i = 1;

function showCateforyResultImage(img){
var len = document.images.length;
var whichImage = Math.round(Math.random()*(p-1));
document.images[0].src = logoImages[whichImage];  // assuming images[0] is ur logo image
//if(img == 'swf')
//	document.images[15].src = buttonImages[whichImage];   // assuming images[1] is ur buttton image
//else
//	document.images[15].src = buttonImages[whichImage];   // assuming images[1] is ur buttton image
//document.images[len-1].src = footerImages[whichImage];   // assuming images[1] is ur buttton image
//document.getElementById('homelink').className=classname[whichImage]; // Done.
//document.getElementById('advlink').className=classname[whichImage]; // Done.
//document.getElementById('catlink').className=classname[whichImage]; // Done.
//document.getElementById('searchadvice').className=classname[whichImage]; // Done.
//document.getElementById('home').className=classname[whichImage]; // Done.
//document.getElementById('sub_cat').className=classname[whichImage]; // Done.
//document.getElementById('companylink').className=classname[whichImage]; // Done.


image_i++;
if (image_i >= p)
 image_i = 1;

}


/*var i = 0;
// Set up the image files to be used.
var logoImages = new Array() // do not change this
var classname = new Array();
var buttonImages = new Array()
var buttonImg = new Array()
var classnameHome = new Array();
var footerImages =  new Array();
// To add more image files, continue with the pattern below, adding to the array.
for (i=0;i<13;i++)
{
	logoImages[i] = "/images/logo_small" + (i+1) + ".jpg"
	buttonImages[i] = "/images/go" + (i+1) + ".jpg"
	buttonImg[i] = "/images/go_trans" + (i+1) + ".gif"
	footerImages[i] = "/images/logo_footer" + (i+1) + ".jpg"
	classnameHome[i] = "adminlink" + (i+1);
	classname[i] = "link" + (i+1);
}
var p = logoImages.length
var image_i = 1;
function showCateforyResultImage(img,flg){
	var len = document.images.length;
	var whichImage = Math.round(Math.random()*(p-1));
	document.images[0].src = logoImages[whichImage];  // assuming images[0] is ur logo image
	document.images[17].src = buttonImg[whichImage];
	/*if(flg!='')
	{
		if(img=='swf')
			document.images[8].src = buttonImg[whichImage];
		else
			document.images[9].src = buttonImg[whichImage];
	}*/
/*	document.images[len-2].src = footerImages[whichImage];   // assuming images[1] is ur buttton image
	document.images[len-1].src = buttonImages[whichImage];   // assuming images[1] is ur buttton image
	document.getElementById('homelink').className=classname[whichImage]; // Done.
	document.getElementById('advlink').className=classname[whichImage]; // Done.
	document.getElementById('catlink').className=classname[whichImage]; // Done.
	document.getElementById('searchadvice').className=classname[whichImage]; // Done.
	if(document.getElementById('sel_link')!=null)
	{
		document.getElementById('sel_link').className=classname[whichImage]; // Done.
		document.getElementById('rfi_link').className=classnameHome[whichImage]; // Done.
		document.getElementById('rfi_link1').className=classnameHome[whichImage]; // Done.
	}
	image_i++;
	if (image_i >= p)
		image_i = 1;
	
}*/

