function checkAll(frmObject,val)
	{		
		f = frmObject;
		for(i=0;f.elements[i];i++)
		{
			if(f.elements[i].type=='checkbox')
			{
				f.elements[i].checked = val;
			}
		}
	}
function checkStat(frmObject,val)
{		
		f = frmObject;
		for(i=0;f.elements[i];i++)
		{
			if(f.elements[i].type=='checkbox')
			{
				f.elements[i].checked = false;
				break;
			}
		}
	}
	function getXmlHttpRequestObject() { 
		if (window.XMLHttpRequest) { 
			return new XMLHttpRequest(); 
		} else if(window.ActiveXObject) { 
			return new ActiveXObject("Microsoft.XMLHTTP"); 
		} else { 
			alert('Status: Cound not create XmlHttpRequest Object. Consider upgrading your browser.'); 
		} 
	} 
	function doAjaxLoadingText(url,method,getStr,postStr,divtag,loading) { 
		var Req = getXmlHttpRequestObject(); 
		if(loading=="yes") { 
			document.getElementById(divtag).innerHTML = "Loading ..."; 
			//document.getElementById(divtag).innerHTML = "<img src='images/loading.gif' />"; 
		} 
		if (Req.readyState == 4 || Req.readyState == 0) {  
			if(method=="GET") { 
				Req.open("GET", url+"?"+getStr, true);  
			} else if(method=="POST") { 
				Req.open("POST", url+"?"+getStr, true);  
				Req.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
			} else { 
				Req.open("GET", url+"?"+getStr, true);  
			} 
			Req.onreadystatechange = function() { 
				if (Req.readyState == 4) {  
					var xmldoc = Req.responseText;  
					if(document.getElementById(divtag)) { 
		 				document.getElementById(divtag).innerHTML = xmldoc; 
					} 
				}  
			}  
			if(method=="GET") { 
				Req.send(null);   
			} else if(method=="POST") { 
				Req.send(postStr);  
			} else { 
				Req.send(null);  
			} 
		} 
	}
	
	function getFormElements(frm) { 
		var getstr = ""; 
		for (i=0; i<frm.length; i++) { 
			//alert(frm.elements[i].tagName+" "+frm.elements[i].name+" "+frm.elements[i].value); 
			if (frm.elements[i].tagName == "INPUT") { 
				if (frm.elements[i].type == "text") { 
					getstr += frm.elements[i].name + "=" + encodeURIComponent(frm.elements[i].value) + "&"; 
				} 
				if (frm.elements[i].type == "password") { 
					getstr += frm.elements[i].name + "=" + encodeURIComponent(frm.elements[i].value) + "&"; 
				} 
		
				if (frm.elements[i].type == "hidden") { 
					getstr += frm.elements[i].name + "=" + encodeURIComponent(frm.elements[i].value) + "&"; 
				} 
				if (frm.elements[i].type == "button") { 
					getstr += frm.elements[i].name + "=" + encodeURIComponent(frm.elements[i].value) + "&"; 
				} 
				if (frm.elements[i].type == "checkbox") { 
					if (frm.elements[i].checked) { 
						getstr += frm.elements[i].name + "=" + encodeURIComponent(frm.elements[i].value) + "&"; 
					} else { 
						getstr += frm.elements[i].name + "=&"; 
					} 
				} 
				if (frm.elements[i].type == "radio") { 
					if (frm.elements[i].checked) { 
						getstr += frm.elements[i].name + "=" + encodeURIComponent(frm.elements[i].value) + "&"; 
					} 
				} 
			} 
			if (frm.elements[i].tagName == "SELECT") { 
				var sel = frm.elements[i]; 
				if(sel.options.length>0) { 
					for (var j=sel.options.length-1; j >= 0;j--) { 
						if (sel.options[j].selected) { 
							getstr += sel.name + "=" + sel.options[j].value + "&"; 
						} 
					} 
				} else { 
					getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&"; 
				} 
			}  
			if (frm.elements[i].tagName == "TEXTAREA") { 
				getstr += frm.elements[i].name + "=" + encodeURIComponent(frm.elements[i].value) + "&"; 
			} 
		} 
		return getstr; 
	} 
	
	
	function doAjaxXMLSelectBox(url,method,getStr,postStr,selectBox) { 
		var Req = getXmlHttpRequestObject(); 
		removeAllOptions(selectBox);
		addOption(selectBox, "Loading....","0");
		if (Req.readyState == 4 || Req.readyState == 0) {  
			if(method=="GET") { 
				Req.open("GET", url+"?"+getStr, true);  
			} else if(method=="POST") { 
				Req.open("POST", url+"?"+getStr, true);  
				Req.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
			} else { 
				Req.open("GET", url+"?"+getStr, true);  
			} 
			Req.onreadystatechange = function() { 
				if (Req.readyState == 4) {  
					var xmldoc = Req.responseXML; 
					if(xmldoc) {      
						var message_nodes = xmldoc.getElementsByTagName("message");  
						var n_messages = message_nodes.length;
						removeAllOptions(selectBox);
						addOption(selectBox, "Select","0");
						for (i = 0; i < n_messages; i++) { 
							name1 = message_nodes[i].getElementsByTagName("name"); 
							id1 = message_nodes[i].getElementsByTagName("id"); 
							name = name1[0].firstChild.nodeValue;
							id = id1[0].firstChild.nodeValue;			
							addOption(selectBox, name, id);
						}
					}
				}  
			}  
			if(method=="GET") { 
				Req.send(null);   
			} else if(method=="POST") { 
				Req.send(postStr);  
			} else { 
				Req.send(null);  
			} 
		} 
	} 

	function handleKey2(e) { 
		// get the event 
		e = (!e) ? window.event : e; 
		// get the code of the character that has been pressed         
		code = (e.charCode) ? e.charCode : ((e.keyCode) ? e.keyCode : ((e.which) ? e.which : 0)); 
		// handle the keydown event        
		if (e.type == "keydown") { 
			// if enter (code 13) is pressed 
			return code; 
		} 
	} 
 
	function toggleLayer(whichLayer, iState) { 
		if (document.getElementById){ 
			// this is the way the standards work 
			var style2 = document.getElementById(whichLayer).style; 
			style2.display = iState? "":"none"; 
		} else if (document.all) { 
			// this is the way old msie versions work 
			var style2 = document.all[whichLayer].style; 
			style2.display = iState? "":"none"; 
		} else if (document.layers) { 
			// this is the way nn4 works 
			var style2 = document.layers[whichLayer].style; 
			style2.display = iState? "":"none"; 
		} 
	} 
 
	function toggleLayer2(whichLayer) { 
		if (document.getElementById){ 
			// this is the way the standards work 
			var style2 = document.getElementById(whichLayer).style; 
			if(style2.display=="") { 
				style2.display = "none"; 
			} else if(style2.display=="none") { 
				style2.display = ""; 
			} 
			//style2.display = iState? "":"none"; 
		} else if (document.all) { 
			// this is the way old msie versions work 
			var style2 = document.all[whichLayer].style; 
			if(style2.display=="") { 
				style2.display = "none"; 
			} else if(style2.display=="none") { 
				style2.display = ""; 
			} 
			//style2.display = iState? "":"none"; 
		} else if (document.layers) { 
			// this is the way nn4 works 
			var style2 = document.layers[whichLayer].style; 
			if(style2.display=="") { 
				style2.display = "none"; 
			} else if(style2.display=="none") { 
				style2.display = ""; 
			} 
			//style2.display = iState? "":"none"; 
		} 
	} 
 
	function toggleLayer3(whichLayer) { 
		if (document.getElementById){ 
			// this is the way the standards work 
			var style2 = document.getElementById(whichLayer).style; 
			return style2.display; 
			//style2.display = iState? "":"none"; 
		} else if (document.all) { 
			// this is the way old msie versions work 
			var style2 = document.all[whichLayer].style; 
			return style2.display; 
			//style2.display = iState? "":"none"; 
		} else if (document.layers) { 
			// this is the way nn4 works 
			var style2 = document.layers[whichLayer].style; 
			return style2.display; 
			//style2.display = iState? "":"none"; 
		} 
	} 
 
	function trim(stringToTrim) { 
		return stringToTrim.replace(/^\s+|\s+$/g,""); 
	} 
	function ltrim(stringToTrim) { 
		return stringToTrim.replace(/^\s+/,""); 
	} 
	function rtrim(stringToTrim) { 
		return stringToTrim.replace(/\s+$/,""); 
	} 
	function uploadFile(obj) {
		uploadDir=obj.value;
		idname=obj.name;
		alert(idname);
		return;
		filename=uploadDir.substr(uploadDir.lastIndexOf('\\')+1);
		//document.getElementById('loading'+idname).innerHTML="<img src='loading.gif' alt='loading...' />";
		uploaderId = obj.id;
		uploader = obj.name;
	
		document.getElementById('imgForm').submit();
		//timeInterval=setInterval("traceUpload()", 1500);
	
		//	Here the file uploading process done 
	}
	
	
	function MM_swapImgRestore() { //v3.0 
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
	} 
	 
	function MM_swapImage() { //v3.0 
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
	}
	
	function removeAllOptions(selectbox) {
		var i;
		for(i=selectbox.options.length-1;i>=0;i--){
			selectbox.remove(i);
		}
	}
	
	function removeOptions(selectbox) {
		var i;
		for(i=selectbox.options.length-1;i>=0;i--) {
			if(selectbox.options[i].selected) {
				selectbox.remove(i);
			}
		}
	}
	
	function addOption(selectbox,text,value ) {
		var optn = document.createElement("OPTION");
		optn.text = text;
		optn.value = value;
		selectbox.options.add(optn);
	}
	
	function addOption_list(selectbox){
		addOption(document.drop_list.SubCat, "One","One");
		addOption(document.drop_list.SubCat, "Two","Two");
		addOption(document.drop_list.SubCat, "Three","Three");
		addOption(document.drop_list.SubCat, "Four","Four");
		addOption(document.drop_list.SubCat, "Five","Five");
		addOption(document.drop_list.SubCat, "Six","Six");
	}
	
	function tripPartners(val)
	{
		if(val=="partner")
		{
			document.getElementById('partners').style.display ="block";
		}else{
				document.getElementById('partners').style.display ="none";
		}
	}
	
	function confirmDialog(msg) {
		returnString = confirm(msg);
		if(returnString) return true;
		else return false;
	}