// JavaScript Document
popup=0;
function changeImg(){
var img_name = new Array("/images/banners/bg1.jpg", "/images/banners/bg2.jpg","/images/banners/bg3.jpg","/images/banners/bg4.jpg","/images/banners/bg5.jpg");
var l = img_name.length;
var rnd_no = Math.floor(l*Math.random());
if(current == rnd_no){
	var rnd_no = Math.floor(l*Math.random());
	document.getElementById("wrapper").style.background = "url('" + img_name[rnd_no] + "') no-repeat center top";
	}else{
	//alert (img_name[rnd_no]);
	document.getElementById("wrapper").style.background = "url('" + img_name[rnd_no] + "') no-repeat center top";
	}
	var current = rnd_no;
}

function openWin(url) 
{
	aWindow = window.open(url,"thewindow",'toolbar=0,location=0,directories=0,status=0,menubar=0, width=400, height=400, scrollbars, resizable');	
	aWindow.focus();
}

function clearText(ob){
if(ob.value =='email / publisher id' || ob.value=='password'){
	ob.value='';
}

}

function setFirstText(ob){

if(ob.value ==''){

ob.value='email / publisher id';
}
}

function setLastText(ob){

if(ob.value ==''){

ob.value='password';
}
}

/*-------------------------------------
Change COuntry Menu
---------------------------------------*/
function showCountry() {
//	document.getElementById("change_country").style.zIndex = "100000";
	
	if(	document.getElementById("change_country").style.display == 'none')	{
		document.getElementById("change_country").style.display = "block";
		document.getElementById("whichcountry").style.backgroundColor = "#fff";
		document.getElementById("whichcountry").style.color = "#000";
		//document.getElementById("change_pickup").style.visibility = "visible";
		document.getElementById("closer").style.display = "block";
		
		
		
		}else{
		document.getElementById("change_country").style.display = "none";
		document.getElementById("whichcountry").style.backgroundColor = "";
		document.getElementById("whichcountry").style.color = "";
		document.getElementById("closer").style.display = "none";
		}
	}

function hideCountry(){
	document.getElementById("change_country").style.display = "none";
	document.getElementById("whichcountry").style.backgroundColor = "";
	document.getElementById("whichcountry").style.color = "";
	document.getElementById("closer").style.display = "none";
	}

function changeCountry(country){
	document.getElementById("change_country").style.display = "none";
	document.getElementById("whichcountry").style.backgroundColor = "";
	document.getElementById("whichcountry").style.color = "";
	document.getElementById("closer").style.display = "none";
	var mycountry = document.getElementById("whichcountry");
	if(country=="usa")
	{
		mycountry.innerHTML="Direct Agents USA (Change)";
		document.getElementById("whichcountry").className = "usa";
	}
	else if(country=="uk"){
		mycountry.innerHTML="Direct Agents UK (Change)";
		document.getElementById("whichcountry").className = "uk";
	}
	else if(country=="india"){
		mycountry.innerHTML="Direct Agents India (Change)";
		document.getElementById("whichcountry").className = "india";
	}
	
}
/*-------------------------------------
Change forms Menu
---------------------------------------*/	
function changeForms(form){
	
	var myform = document.getElementById("whichform");
	if(form=="traffic")
	{
		document.getElementById("tracking").style.display = "none";
		document.getElementById("traffic").style.display = "inline";
	}
	else if(form=="tracking"){
		document.getElementById("tracking").style.display = "inline";
		document.getElementById("traffic").style.display = "none";
	}
	
}

/*-------------------------------------
Feedback
---------------------------------------*/

function showFeedback(whichForm){
	popup=1;
	
	//OpenTestPopup();
	var windowSize = getWindowSize();
	
	var totalHeight = Window.getScrollHeight();
	var totalWidth = window.screen.width;
	if(windowSize.X <978){
		totalWidth = 1000;
	}
	
	var feedbackX = (totalWidth - 530)/2;
	var feedbackY = (totalHeight - 440)/2;
	var feedbackY = feedbackY - 100;
	
	
	document.getElementById("fade").style.height = totalHeight + "px";
	document.getElementById("fade").style.width = totalWidth + "px";
	
	//document.getElementById("fade").style.zIndex=1;
	//document.getElementById("test2").style.zIndex=100;
	document.getElementById("fade").style.display='block';
	
	
	//alert(document.getElementById("wrapper").width + " :: " + windowSize.X + " : " + document.getElementById("wrapper").offsetHeight)
	

	//document.getElementById("light").style.top=feedbackY + "px";
	//document.getElementById("light").style.left=feedbackX + "px";
	
	leftPos = ((Window.getWindowWidth() / 2) - 265)+Window.getScrollLeft();
	topPos = ((Window.getWindowHeight() / 2) - 220)+Window.getScrollTop();
	
	document.getElementById("lightBox").style.top = topPos + 'px';
	document.getElementById("lightBox").style.left = leftPos + 'px';
	//document.getElementById("lightBox").style.margin =topPos+"px auto";
	
	document.getElementById("lightBox").style.display='block';
	document.getElementById("formLoader").style.display='block';
	//document.getElementById('queries').style.display='block';
    
	
	generateForm(whichForm)

	//window.opener.document.getElementById("closeme").style.display='block';
}

function hideFeedback(){
	var myform = window.parent.document.getElementById("formLoader");
	var mydiv = window.parent.document.getElementById("lightBox");
	var fader = window.parent.document.getElementById("fade");
	myform.innerHTML=""
	myform.style.display='none';
	mydiv.style.display='none';
	fader.style.display='none';
	//window.parent.document.getElementById("fade").style.display='none';
	//window.parent.document.getElementById('thanks').style.display='none';
	//window.parent.document.getElementById("closeme").style.display='none';

	//alert(mydiv);
	//mydiv.innerHTML="";
	
}

function generateForm(whichForm){
	var myform = document.getElementById("formLoader");
	var paras = document.getElementsByTagName("p");
	var formtitle = document.getElementsByTagName("em");
	if(whichForm=="contactForm"){
	myform.innerHTML="<iframe id='myframe' src='../includes/global/contactform.php' height=320 width=400 frameborder=0 scrolling=no marginheight=0 marginwidth=0></iframe>";
	paras[0].innerHTML="Drop us a line and we'll get back to you quickly";
	formtitle[0].innerHTML="Questions?";
	}
	else{
		myform.innerHTML="<iframe id='myframe' src='../includes/global/callback.php' height=320 width=400 frameborder=0 scrolling=no marginheight=0 marginwidth=0></iframe>";
		paras[0].innerHTML="Have one of our representatives call you";
	formtitle[0].innerHTML="Request a Call Back ";
	}
   //alert(mydiv.innerHTML);
}




/*

function createWashOut(){
	var bodyElement  = document.getElementsByTagName('body')[0];
	var div = document.createElement('div');
	div.setAttribute('id','washout');
	bodyElement.appendChild(div);
	var totalWash = document.body.offsetHeight;
	document.getElementById("washout").style.height = totalWash + "px";
	document.getElementById("washout").innerHTML="<!--[if lte IE 6.5]><iframe></iframe><![endif]-->"
	bodyElement.style.overflow='hidden';
	
	}
function removeWashOut(){
	var bodyElement  = document.getElementsByTagName('body')[0];
	var remove = document.getElementById('washout');
	bodyElement.removeChild(remove);
	bodyElement.style.overflow='';
	}
	*/
	
	
	
/*
Function to validate contact form
*/		
function valForm_contact(theform)
{
	var subject = document.getElementById("subject").value;
	var name = document.getElementById("name").value;
	var emailid = document.getElementById("emailid").value;
	var company = document.getElementById("company").value;
	var phone= document.getElementById("phone").value;
	var comments= document.getElementById("comments").value;
	
	if(subject==0){
		showError("The Subject cannot be blank");
		document.getElementById("subject").focus();
		changeError('subject')
		return false;
	}else{
		changeProper('subject')
	}
	
	//alert(fname);
	if(name==""){
		showError("The Name cannot be left blank");
		document.getElementById("name").focus();
		changeError('name')
		return false;
	}else if(isNum(name)){
			//alert("name " + name);
			showError("Numbers are not allowed in the name");
			document.getElementById("name").focus();
			changeError('name')
			return false;
	}
	else if(isSpchar(name)){
			showError("Special characters not allowed in the name");
			document.getElementById("name").focus();
			changeError('name')
			return false;
	}
	else{
		changeProper('name')
	}
	
	if(emailid==""){
		showError("The Email Id cannot be left blank");
		document.getElementById("emailid").focus();
		changeError('emailid');
		return false;
	}else{
		changeProper('emailid')
	} 
	
	if(!isValidEmail(emailid))
	{
		showError("Invalid email address.");
		document.getElementById("emailid").focus();
		changeError('emailid')
		return false;
	}else{
		changeProper('emailid')
	}
	
	
	if(company==""){
		showError("The Company cannot be blank");
		document.getElementById("company").focus();
		changeError('company')
		return false;
	}else{
		changeProper('company')
	}
	
	
	if(phone==""){
		showError("Phone Number should not be blank");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
	/*
	if(!isNumber(phone))
	{
		showError("Please enter numbers only");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
	*/
	
	if(comments==""){
		showError("The Comments cannot be blank");
		document.getElementById("comments").focus();
		changeError('comments')
		return false;
	}else{
		changeProper('comments')
	}
		//toogleElement('msg','none')
		//showThanks(theform)
		
		
}		

/*
Function to validate Request CallBack
*/	

function valForm_callBack(theform)
{
	var fname = document.getElementById("fname").value;
	var lname = document.getElementById("lname").value;
	var emailid = document.getElementById("emailid").value;
	var company = document.getElementById("company").value;
	var country= document.getElementById("country").value;
	var phone= document.getElementById("phone").value;
	var time= document.getElementById("time").value;
	
	if(fname==""){
		showError("The first name cannot be left blank");
		document.getElementById("fname").focus();
		changeError('fname')
		return false;
	}else if(isNum(name)){
			//alert("name " + name);
			showError("Numbers are not allowed in the name");
			document.getElementById("fname").focus();
			changeError('lname')
			return false;
	}
	else if(isSpchar(name)){
			showError("Special characters not allowed in the name");
			document.getElementById("fname").focus();
			changeError('fname')
			return false;
	}
	else{
		changeProper('fname')
	}
	
	//alert(fname);
	if(lname==""){
		showError("The last Name cannot be left blank");
		document.getElementById("lname").focus();
		changeError('lname')
		return false;
	}else if(isNum(lname)){
			//alert("name " + name);
			showError("Numbers are not allowed in the name");
			document.getElementById("lname").focus();
			changeError('lname')
			return false;
	}
	else if(isSpchar(lname)){
			showError("Special characters not allowed in the name");
			document.getElementById("lname").focus();
			changeError('lname')
			return false;
	}
	else{
		changeProper('lname')
	}
	
	if(emailid==""){
		showError("The Email Id cannot be left blank");
		document.getElementById("emailid").focus();
		changeError('emailid');
		return false;
	}else{
		changeProper('emailid')
	} 
	
	if(!isValidEmail(emailid))
	{
		showError("Invalid email address.");
		document.getElementById("emailid").focus();
		changeError('emailid')
		return false;
	}else{
		changeProper('emailid')
	}
	
	
	if(company==""){
		showError("The Company cannot be blank");
		document.getElementById("company").focus();
		changeError('company')
		return false;
	}else{
		changeProper('company')
	}
	
	if(country==""){
		showError("The Country cannot be blank");
		document.getElementById("country").focus();
		changeError('country')
		return false;
	}else{
		changeProper('country')
	}
	
	
	if(phone==""){
		showError("Phone Number should not be blank");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
	
	if(!isNumber(phone))
	{
		showError("Please enter numbers only");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
		//toogleElement('msg','none')
		//showThanks(theform)
		
		
}
/*
Function to validate Publihser form
*/		
function valForm_publisher(theform)
{
	var company = document.getElementById("company").value;
	var fname = document.getElementById("fname").value;
	var lname = document.getElementById("lname").value;
	var emailid = document.getElementById("emailid").value;
	var add1 = document.getElementById("add1").value;
	var city = document.getElementById("city").value;
	var state = document.getElementById("state").value;
	var other = document.getElementById("other").value;
	var zip = document.getElementById("zip").value;
	var phone = document.getElementById("phone").value;
	var country= document.getElementById("country").value;
	var password= document.getElementById("password").value;
	var website = document.getElementById("website").value;


	
	
	if(company==""){
		showError("The company name cannot be left blank");
		document.getElementById("company").focus();
		changeError('company')
		return false;
	}else{
		changeProper('company')
	}
	
	//alert(fname);
	if(fname==""){
		showError("The first name cannot be left blank");
		document.getElementById("fname").focus();
		changeError('fname')
		return false;
	}else if(isNum(fname)){
			//alert("name " + name);
			showError("Numbers are not allowed in the first name");
			document.getElementById("fname").focus();
			changeError('fname')
			return false;
	}
	else if(isSpchar(fname)){
			showError("Special characters are not allowed in the first name");
			document.getElementById("fname").focus();
			changeError('fname')
			return false;
	}
	else{
		changeProper('fname')
	}
	
	if(lname==""){
		showError("The last name cannot be left blank");
		document.getElementById("lname").focus();
		changeError('lname')
		return false;
	}else if(isNum(lname)){
			//alert("name " + name);
			showError("Numbers are not allowed in the last name");
			document.getElementById("lname").focus();
			changeError('lname')
			return false;
	}
	else if(isSpchar(lname)){
			showError("Special characters not allowed in the last name");
			document.getElementById("lname").focus();
			changeError('lname')
			return false;
	}
	else{
		changeProper('fname')
	}
	
	if(emailid==""){
		showError("The Email Id cannot be left blank");
		document.getElementById("emailid").focus();
		changeError('emailid');
		return false;
	}else{
		changeProper('emailid')
	} 
	
	if(!isValidEmail(emailid))
	{
		showError("Invalid email address.");
		document.getElementById("emailid").focus();
		changeError('emailid')
		return false;
	}else{
		changeProper('emailid')
	}
	
	if(add1==""){
		showError("The address cannot be left blank");
		document.getElementById("add1").focus();
		changeError('add1')
		return false;
	}else{
		changeProper('add1')
	}
	
	if(city==""){
		showError("The address cannot be left blank");
		document.getElementById("city").focus();
		changeError('city')
		return false;
	}else{
		changeProper('city')
	}
	
	if(state==0){

		showError("The state cannot be left blank");
		document.getElementById("state").focus();
		changeError('state')
		return false;
	}else{
		changeProper('state')

	}
	
	if(zip==""){
		showError("Zip/post Code should not be blank");
		document.getElementById("zip").focus();
		changeError('zip')
		return false;
	}else{
		changeProper('zip')
	}
	
	if(!isNumber(zip))
	{
		showError("Please enter numbers only");
		document.getElementById("zip").focus();
		changeError('zip')
		return false;
	}else{
		changeProper('zip')
	}
	
	
	if(phone==""){
		showError("Phone Number should not be blank");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
	
	if(!isNumber(phone))
	{
		showError("Please enter numbers only");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
	
	if(country==""){
		showError("Please select your country");
		document.getElementById("country").focus();
		changeError('country')
		return false;
	}else{
		changeProper('country')
	}
	
	if(password==""){
		showError("The password cannot be blank");
		document.getElementById("password").focus();
		changeError('password')
		return false;
	}else{
		changeProper('password')
	}
	
	if(website==""){
		showError("The website cannot be blank");
		document.getElementById("website").focus();
		changeError('website')
		return false;
	}else{
		changeProper('website')
	}
	
	
	
	
	if(!document.getElementById("agree").checked){
       
            showError("Please Agree to the Terms & Conditions to continue Sign up");
            document.getElementById("agree").focus();
            changeError('myagree')
            return false;
           
        }
        else{
            changeProper('myagree')
        }
	
				
		//document.write("<?php $doneReg=1 ?>");
		
		//toogleElement('msg','none')
		//showThanks(theform)
		
		
}

/*
Function to validate ADvertiser form
*/		
function valForm_advertiser(theform)
{
	
	var service = document.getElementById("service");
//	var title = document.getElementById("title").value;
	var fname = document.getElementById("fname").value;
//	var mname = document.getElementById("mname").value;
	var lname = document.getElementById("lname").value;
	var emailid = document.getElementById("emailid").value;
	//var password= document.getElementById("password").value;
	//var cpassword= document.getElementById("cpassword").value;
	var company= document.getElementById("company").value;
	//var add1 = document.getElementById("add1").value;
	//var add2 = document.getElementById("add2").value;
	var city = document.getElementById("city").value;
	var state = document.getElementById("state").value;
	var other = document.getElementById("other").value;
	//var zip = document.getElementById("zip").value;
	//var country= document.getElementById("country").value;
	var phone = document.getElementById("phone").value;
	//var fax = document.getElementById("fax").value;
	var sign = document.getElementById("sign").value;


	var serviceSelected = 0;
	var serviceArray = new Array();
	for(var i=0;i<service.length;i++){
		if(service[i].selected){
			serviceSelected=1;
			serviceArray.push(service[i].value)
		}
	}
	if(!serviceSelected){		
		showError("Please select the Service");
		document.getElementById("service").focus();
		changeError('service')
		return false;
	}else{
		alert(serviceArray);
		changeProper('service')
		document.getElementById("servicesselected").value=serviceArray;
	}
	/*if(service==0 || service==""){
		showError("Please select the Service");
		document.getElementById("service").focus();
		changeError('service')
		return false;
	}else {
		changeProper('service')
	}*/
	//alert(service);
/*
	if(title==0){
		showError("Please select your title");
		document.getElementById("title").focus();
		changeError('title')
		return false;
	}else {
		changeProper('title')
	}
*/

	//alert(fname);
	if(fname==""){
		showError("The first name cannot be left blank");
		document.getElementById("fname").focus();
		changeError('fname')
		return false;
	}else if(isNum(fname)){
			//alert("name " + name);
			showError("Numbers are not allowed in the first name");
			document.getElementById("fname").focus();
			changeError('fname')
			return false;
	}
	else if(isSpchar(fname)){
			showError("Special characters are not allowed in the first name");
			document.getElementById("fname").focus();
			changeError('fname')
			return false;
	}
	else{
		changeProper('fname')
	}
	
	if(lname==""){
		showError("The last name cannot be left blank");
		document.getElementById("lname").focus();
		changeError('lname')
		return false;
	}else if(isNum(lname)){
			//alert("name " + name);
			showError("Numbers are not allowed in the last name");
			document.getElementById("lname").focus();
			changeError('lname')
			return false;
	}
	else if(isSpchar(lname)){
			showError("Special characters not allowed in the last name");
			document.getElementById("lname").focus();
			changeError('lname')
			return false;
	}
	else{
		changeProper('lname')
	}
	
	if(emailid==""){
		showError("The Email Id cannot be left blank");
		document.getElementById("emailid").focus();
		changeError('emailid');
		return false;
	}else{
		changeProper('emailid')
	} 
	
	if(!isValidEmail(emailid))
	{
		showError("Invalid email address.");
		document.getElementById("emailid").focus();
		changeError('emailid')
		return false;
	}else{
		changeProper('emailid')
	}
	/*
	if(password==""){
		showError("The password cannot be blank");
		document.getElementById("password").focus();
		changeError('password')
		return false;
	}else{
		changeProper('password')
	}
	
	if(cpassword==""){
		showError("The confirm password cannot be blank");
		document.getElementById("cpassword").focus();
		changeError('cpassword')
		return false;
	}else{
		changeProper('cpassword')
	}
	
	if(password!=cpassword){
		showError("The password and confirm password should be same");
		document.getElementById("cpassword").focus();
		changeError('password')
		changeError('cpassword')
		return false;
	}else{
		changeProper('password')
		changeProper('cpassword')
	}
	*/
	
	if(company==""){
		showError("The company name cannot be left blank");
		document.getElementById("company").focus();
		changeError('company')
		return false;
	}else{
		changeProper('company')
	}
	/*
	if(add1==""){
		showError("The address cannot be left blank");
		document.getElementById("add1").focus();
		changeError('add1')
		return false;
	}else{
		changeProper('add1')
	}
	*/
	if(city==""){
		showError("The address cannot be left blank");
		document.getElementById("city").focus();
		changeError('city')
		return false;
	}else{
		changeProper('city')
	}
	
	if(state==0){

		showError("The state cannot be left blank");
		document.getElementById("state").focus();
		changeError('state')
		return false;
	}else{
		changeProper('state')
	
	}
	/*
	if(zip==""){
		showError("Zip/post Code should not be blank");
		document.getElementById("zip").focus();
		changeError('zip')
		return false;
	}else{
		changeProper('zip')
	}
	
	if(!isNumber(zip))
	{
		showError("Please enter numbers only");
		document.getElementById("zip").focus();
		changeError('zip')
		return false;
	}else{
		changeProper('zip')
	}
	
	
	if(country==""){
		showError("Please select your country");
		document.getElementById("country").focus();
		changeError('country')
		return false;
	}else{
		changeProper('country')
	}
	
	*/
	if(phone==""){
		showError("Phone Number should not be blank");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
	
	if(!isNumber(phone))
	{
		showError("Please enter numbers only");
		document.getElementById("phone").focus();
		changeError('phone')
		return false;
	}else{
		changeProper('phone')
	}
	/*

	if(!document.getElementById("agree").checked){
       
            showError("Please Agree to the Terms & Conditions to continue Sign up");
            document.getElementById("agree").focus();
            changeError('myagree')
            return false;
           
        }
        else{
            changeProper('myagree')
        }
	
	*/
	if(sign==""){
		showError("Signature should not be blank");
		document.getElementById("phone").focus();
		changeError('sign')
		return false;
	}else{
		changeProper('sign')
	}
	
	//	toogleElement('msg','none')
		//showThanks(theform)
		
		
}

/*
function to open terms and conditions page
*/
function openTerms( pageToLoad, winName, width, height, center)
{
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
	
	//0 => no
	//1 => yes
    var args = "";
    	args += "width=" + width + "," + "height=" + height + ","
		+ "location=0,"
		+ "menubar=0,"
		+ "resizable=0,"
		+ "scrollbars=1,"
		+ "statusbar=true,dependent,alwaysraised,"
		+ "status=false,"
		+ "titlebar=no,"
		+ "toolbar=0,"
		+ "hotkeys=0,"
		+ "screenx=" + xposition + ","  //NN Only
		+ "screeny=" + yposition + ","  //NN Only
		+ "left=" + xposition + ","     //IE Only
		+ "top=" + yposition;           //IE Only
		//fullscreen=yes, add for full screen
    	var dmcaWin = window.open(pageToLoad,winName,args );
    	dmcaWin.focus();
    //window.showModalDialog(pageToLoad,"","dialogWidth:650px;dialogHeight:500px");
}


/*
Common Function to validate contact form
*/	
function trim(str)
{ 
	return((""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') ); 
}

function isSpchar(value){
  var iChars = "!@#$%^&*()+=-[]\';,./{}|\":<>?";

  for (var i = 0; i < value.length; i++) {
  	if (iChars.indexOf(value.charAt(i)) != -1) 
  	{
  		return true;
  	}
  }	
  return false;
}

function isNumber(str){
	
//	var filter=/^[\d]+$/;
	var filter=/^[0-9]+$/;
	if(filter.test(trim(str)))
	return true;
	else
	return false;
}

function isNum(value){
  var iChars = "0123456789";

  for (var i = 0; i < value.length; i++) {
  	if (iChars.indexOf(value.charAt(i)) != -1) 
  	{
  		return true;
  	}
  }	
  return false;
}

function isValidEmail(value){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if(filter.test(trim(value)))
		return true;
	else
		return false;
	
}

function toogleElement(EleName,style){
	var objEle = document.getElementById(EleName);
	if(objEle)
		objEle.style.display=style;
}

function showNotification(msg){
	showStatus(msg,'statusMsg');
}
function showError(msg){
	showStatus(msg,'statusErr');
}
function showStatus(msg,type){

	var ele = document.getElementById('msg');
	ele.innerHTML = msg;
	ele.className = type;

	toogleElement('msg','block');
	try{
	increaseHeight()
	}catch(e){}
}

function changeError(id){
	document.getElementById(id).style.borderStyle="solid";
	document.getElementById(id).style.borderColor="red";
	}
function changeProper(id){
	document.getElementById(id).style.borderStyle="";
	document.getElementById(id).style.borderColor="";
	}

function showThanks(formdiv){
	toogleElement(formdiv,'none');
	toogleElement('thanks','block');
}
function showform(url){
//alert(parent.popup);
	if(parent.popup==1)
	{
	//	alert("calling show form");
		hideFeedback();
		popup=false;
	}else{
	location=url;
	}
}

//To get window size
function getWindowSize()
{
  var myWidth = 0, myHeight = 0;
 
  if( typeof( window.innerWidth ) == 'number' )
  {
    //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
  }
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
       //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth ;
        myHeight = document.documentElement.clientHeight;
  }
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
  }
 
  var X= myWidth;
  var Y= myHeight;
 
  return {X:X, Y:Y};
}

Window = {	
	//Returns an integer representing the width of the browser window (without the scrollbar).
	getWindowWidth : function() {
	return (document.layers||(document.getElementById&&!document.all)) ? window.outerWidth : (document.all ? document.body.clientWidth : 0);
	},
	
	//Returns an integer representing the height of the browser window (without the scrollbar).
	getWindowHeight : function() {	
	return window.innerHeight ? window.innerHeight :(document.getBoxObjectFor ? Math.min(document.documentElement.clientHeight, document.body.clientHeight) : ((document.documentElement.clientHeight != 0) ? document.documentElement.clientHeight : (document.body ? document.body.clientHeight : 0)));
	},	
	
	//Returns an integer representing the scrollWidth of the window. 
	getScrollWidth : function() {
		return document.all ? Math.max(Math.max(document.documentElement.offsetWidth, document.documentElement.scrollWidth), Math.max(document.body.offsetWidth, document.body.scrollWidth)) : (document.body ? document.body.scrollWidth : ((document.documentElement.scrollWidth != 0) ? document.documentElement.scrollWidth : 0));
	},
	
	//Returns an integer representing the scrollHeight of the window. 
	getScrollHeight : function(){		
		return document.all ? Math.max(Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.body.scrollHeight)) : (document.body ? document.body.scrollHeight : ((document.documentElement.scrollHeight != 0) ? document.documentElement.scrollHeight : 0));
	},			
	
	//Returns an integer representing the scrollLeft of the window (the number of pixels the window has scrolled from the left).
	getScrollLeft : function() {
		return document.all ? (!document.documentElement.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft) : ((window.pageXOffset != 0) ? window.pageXOffset : 0);
	},
	
	//Returns an integer representing the scrollTop of the window (the number of pixels the window has scrolled from the top).
	getScrollTop : function() {
		return document.all ? (!document.documentElement.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop) : ((window.pageYOffset != 0) ? window.pageYOffset : 0);
	}
}
		
//Test function		
function OpenTestPopup() {
	alert("Window Width : " + Window.getWindowWidth() + " px\n"
		+ "Window Height : " + Window.getWindowHeight() + " px\n"
		+ "Scroll Width : " + Window.getScrollWidth() + " px\n"
		+ "Scroll Height : " + Window.getScrollHeight() + " px\n"
		+ "Scroll Left : " + Window.getScrollLeft() + " px\n"
		+ "Scroll Top : " + Window.getScrollTop() + " px");
}

var Swapper = function() {
	this.index = 0;
	this.swapClass;
	this.swapContentName;	               
	this.Interval = 8000;
	this.size;
	
	
	this.timerId = 0;
	var thisObject;
	
	this.DoSwapContent = function() {	
		this.stop();
		var swapItem = document.getElementById(this.swapClass);		
	        
	        if (swapItem != undefined) {
	         	var tempClass = this.swapClass + ((this.index % this.size));
	         	swapItem.setAttribute("class", tempClass );
	                swapItem.setAttribute("className", tempClass);
	                var swapContent = document.getElementById(this.swapContentName);
	                swapContent.innerHTML = document.getElementById(tempClass).innerHTML;
	                this.setInactive();
	                this.setActive((this.index % this.size));
	        }
	        this.index = this.index + 1;
	        this.timerId = setInterval(
	            	function() {
		 		thisObject.DoSwapContent(); 
			}, thisObject.Interval);
	}

	this.click = function( newIndex ) {
		this.stop();
		this.index = newIndex;
		this.DoSwapContent();		
	}
	
	this.setActive = function(whichIndex) {
		button = document.getElementById(this.swapClass+"dot"+whichIndex);
		button.setAttribute("src", "/images/newscircleblock.gif");
	}
	
	this.setInactive = function() {
		for(var i=0; i<this.size; i++) {
			button = document.getElementById(this.swapClass+"dot"+i);
			button.setAttribute("src", "/images/newscircle.gif");
		}
	}
	
	this.start = function() {
		thisObject = this;	
		this.DoSwapContent();					
	};
	
	this.stop = function() {
		clearInterval(this.timerId);
	};	
};

var CS = new Swapper();
CS.swapClass = "swap";
CS.swapContentName = "swapcontent";
CS.size = 4;
CS.start();

