 

 

var checkboxHeight = "25";
var radioHeight = "35";
var selectWidth = "179";
var selectWidthSmall="64";
/* No need to change anything after this */

document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style><style type="text/css">input.styledsmall { display: none; } select.styledsmall { position: relative; width: ' + selectWidthSmall + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		
		 
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
				
				
				
				
			}
			
			 
	
			
			
			else if (inputs[a].className == "styledsmall")
			{
			
			
			option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "selectsmall";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			
			
			
			
			}
		}
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				
				 document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			 
			}
		}
	}
}
window.onload = Custom.init;
 
   function mike()
   {
	alert('hi');   
	   
   }
  function temp(form)
  {
  var y = parseFloat(form.country.value, 10);
  var u=100*y;
  var a = parseFloat(u, 10);
 
  var f = parseFloat(form.RateFrom.value, 10);
  var t = parseFloat(form.RateTo.value, 10);
  var c = 0;
  c = a * f / t;
  c = Math.round(1000*c)/1000;

  
  form.Exchange.value ="100 Min. Will Cost " + c ;//(u*y)*100 ;
  
  }
 
 
 function closeaccourdian()
 {
 
 
 
 }
 
 
 
 function onchangecombo()
{
 
	  
	  var t= document.getElementById('myHidden');
 
	 	 
  getInfo(t.value);
}
var adjust=0
 
function getInfo(comboValueTo)
{
 	
var str=comboValueTo;
var result = str.split("%");
var RatesCall=eval(result[0]);
var RatesCallPremium=(eval(result[0])+eval(0.6)).toFixed(2); 
document.getElementById("cRate").innerHTML="<div class=crate>"+RatesCall+"&cent;/min.</div>"; 
//document.getElementById("a1").innerHTML=result[0]; 
document.getElementById("a5").innerHTML=Math.round(eval(1000/eval(result[0])))+' min'; 
//document.getElementById("b1").innerHTML=result[0]; 
document.getElementById("b10").innerHTML=Math.round(eval(2000/eval(result[0])))+' min'; 

 
document.getElementById("cImage").innerHTML="<img style='border:1px solid black' src='images/countryflags/"+result[3]+"' width=30 height=20 />"; 

document.getElementById("sign").style.background="white url(images/signs/"+result[4]+")  no-repeat top center";
  
 
document.getElementById("cRate2").innerHTML="<div class=crate>"+ eval(RatesCallPremium) +"&cent;/min.</div>"; 
//document.getElementById("a1").innerHTML=result[0]; 
document.getElementById("a52").innerHTML=Math.round(eval(1000/eval(RatesCallPremium)))+' min'; 
//document.getElementById("b1").innerHTML=result[0]; 
document.getElementById("b102").innerHTML=Math.round(eval(2000/eval(RatesCallPremium)))+' min'; 

 
document.getElementById("cImage2").innerHTML="<img style='border:1px solid black' src='images/countryflags/"+result[3]+"' width=30 height=20 />"; 

document.getElementById("sign2").style.background="white url(images/signs/"+result[4]+")  no-repeat top center";
 
 
 
adjust=0;

GMT=result[1];

if ((GMT!=null) && (GMT!=''))
{
 getDateTimeNow();
}
 

document.getElementById("cName").innerHTML="Calling To "+result[2] ; 
document.getElementById("cName2").innerHTML="Calling To "+result[2] ; 
//document.getElementById("cName3").innerHTML="Calling To "+result[2] ; 
 
}



function getDateTimeNow()
{
var today = new Date();
var year = today.getYear() + 1900;
var month = today.getMonth()+1;
var date = today.getDate();
var day = today.getDay();
var hour = today.getHours();
var minute = today.getMinutes();
var second = today.getSeconds();

var a_p = "";
var d = new Date();


var dot=GMT.indexOf(".");
 
var curr_min = d.getMinutes();
var min=0;
if (dot!=-1)
{
min=GMT.substring(dot+1,GMT.length);

var hrs=GMT.substring(0,dot);
}
else
{

var hrs=GMT;

} 


Date.prototype.addHours = function (n) {this.setHours (this.getHours () + n)}
Date.prototype.addMinutes = function (n) {this.setMinutes (this.getMinutes () + n)}
Date.prototype.toDateString = function () {return [this.getDate(), this.getMonth() + 1, this.getFullYear()].join ('-')}

Date.prototype.toString = function () {return [this.toDateString(), this.toTimeString()].join (' ')}


now = new Date()
now.addHours(5);
now.addHours(eval(hrs))
now.addMinutes(eval(min));

curr_min = now.getMinutes();


var curr_hour=now.getHours();
 
if (curr_hour < 12)
   {
   a_p = "am";
   }
else
   {
   a_p = "pm";
   }
if (curr_hour == 0)
   {
   curr_hour = 12;
   }
if (curr_hour > 12)
   {
   curr_hour = curr_hour - 12;
   }


var curr_sec=d.getSeconds();
curr_min = curr_min + "";

if (curr_min.length == 1)
   {
   curr_min = "0" + curr_min;
   }

dateTime=curr_hour + ":" + curr_min + ":" + curr_sec  + " " + a_p;
document.getElementById("cTime").innerHTML = "<font style='color:maroon;font-size:9px;'>" + dateTime + "</font>";
document.getElementById("cTime2").innerHTML = "<font color=maroon>" + dateTime + "</font>";
//document.getElementById("cTime3").innerHTML = "<font color=maroon>" + dateTime + "</font>";

setTimeout("getDateTimeNow()",900);


 }

 
 




 
 
 
function validate(form) {
  var name = form.name.value;
  var email = form.email.value;
  var gender = form.gender.value;
  var message = form.message.value;
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  if(name == "") {
    inlineMsg('name','You must enter your name.',2);
    return false;
  }
  if(!name.match(nameRegex)) {
    inlineMsg('name','You have entered an invalid name.',2);
    return false;
  }
  if(email == "") {
    inlineMsg('email','<strong>Error</strong><br />You must enter your email.',2);
    return false;
  }
  if(!email.match(emailRegex)) {
    inlineMsg('email','<strong>Error</strong><br />You have entered an invalid email.',2);
    return false;
  }
  if(gender == "") {
    inlineMsg('gender','<strong>Error</strong><br />You must select your gender.',2);
    return false;
  }
  if(message == "") {
    inlineMsg('message','You must enter a message.');
    return false;
  }
  if(message.match(messageRegex)) {
    inlineMsg('message','You have entered an invalid message.');
    return false;
  }
  return true;
}

// START OF MESSAGE SCRIPT //

var MSGTIMER = 20;
var MSGSPEED = 10;
var MSGOFFSET = 3;
var MSGHIDE = 0;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target,string,autohide) {
  var msg;
  var msgcontent;
  if(!document.getElementById('msg')) {
    msg = document.createElement('div');
    msg.id = 'msg';
    msgcontent = document.createElement('div');
    msgcontent.id = 'msgcontent';
    document.body.appendChild(msg);
    msg.appendChild(msgcontent);
    msg.style.filter = 'alpha(opacity=0)';
    msg.style.opacity = 0;
    msg.alpha = 0;
  } else {
    msg = document.getElementById('msg');
    msgcontent = document.getElementById('msgcontent');
  }
  msgcontent.innerHTML = string;
  msg.style.display = 'block';
  var msgheight = msg.offsetHeight;
  var targetdiv = document.getElementById(target);
  targetdiv.focus();
  var targetheight = targetdiv.offsetHeight;
  var targetwidth = targetdiv.offsetWidth;
  var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
  var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
  msg.style.top = topposition + 'px';
  msg.style.left = leftposition + 'px';
  clearInterval(msg.timer);
  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
  if(!autohide) {
    autohide = MSGHIDE;  
  }
  window.setTimeout("hideMsg()", (autohide * 1000));
}

// hide the form alert //
function hideMsg(msg) {

  if (document.getElementById('msg')!=null)
  {
  var msg = document.getElementById('msg');
  if(!msg.timer) {
    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
  }
  }
}

// fade the message box //
function fadeMsg(flag) {
  if(flag == null) {
    flag = 1;
  }
  var msg = document.getElementById('msg');
  var value;
  if(flag == 1) {
    value = msg.alpha + MSGSPEED;
  } else {
    value = msg.alpha - MSGSPEED;
  }
  msg.alpha = value;
  msg.style.opacity = (value / 100);
  msg.style.filter = 'alpha(opacity=' + value + ')';
  if(value >= 99) {
    clearInterval(msg.timer);
    msg.timer = null;
  } else if(value <= 1) {
    msg.style.display = "none";
    clearInterval(msg.timer);
  }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
  var left = 0;
  if(target.offsetParent) {
    while(1) {
      left += target.offsetLeft;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.x) {
    left += target.x;
  }
  return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
  var top = 0;
  if(target.offsetParent) {
    while(1) {
      top += target.offsetTop;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.y) {
    top += target.y;
  }
  return top;
}

 





















