// JavaScript Document

var xmlhttp_market,xmlhttp_demo_applicationx;
var base_url_market = "http://"+window.location.hostname+"/index.php/main/";
var base_url_new = "http://"+window.location.hostname+"/index.php/newhome/";
var base_url_rna = "http://"+window.location.hostname+"/index.php/research_and_analysis/";
var base_url_tp = "http://"+window.location.hostname+"/index.php/tradingplatform/";
var base_url_tpSSL = "https://"+window.location.hostname+"/index.php/tradingplatform/";
var timeOut;

var primary = 10;

function load_lightwindow_content(){
	$.ajax({
		type: "POST",
		url: base_url_new+"load_lightwindow_content"
	}).done(function( msg ) {
		$("div#lightwindow-main-holder").html(msg);
	});		
}

function primary_link(id){
	primary = id;	
	if(primary != 0){
		var divid = "subnav_div"+primary;
		document.getElementById(divid).style.display = "block";
	}
}

function show_subdiv(id){
	clearTimeout(timeOut);
	//if(primary != id){
		for(var cnt=1;cnt<=6;cnt++){
			var dividx = "subnav_div"+cnt;
			document.getElementById(dividx).style.display = "none";
		}
		
		for(var cnt=0;cnt<=6;cnt++){
			var divnav = "primarylink_"+cnt;
			document.getElementById(divnav).className = "normal_link";			
		}
		
		for(var cnt=1;cnt<=13;cnt++){
			var dividx = "subnavUlSub"+cnt;
			document.getElementById(dividx).style.display = "none";
		}	
		
		if(primary != 0){
			var divid = "subnav_div"+primary;
			document.getElementById(divid).style.display = "none";
		}
		if(id != 0){
			var divid = "subnav_div"+id;
			$("#"+divid).fadeIn(500, function () { });
		}
		
		for(var cnt=1;cnt<=13;cnt++){
			var dividx = "subnavUlSub"+cnt;
			document.getElementById(dividx).style.display = "none";
		}
	//}
}

function show_subdiv2(id){
	clearTimeout(timeOut);
	//if(primary != id){
		for(var cnt=1;cnt<=6;cnt++){
			var dividx = "subnav_div"+cnt;
			document.getElementById(dividx).style.display = "none";
		}
		
		for(var cnt=0;cnt<=6;cnt++){
			var divnav = "primarylink_"+cnt;
			document.getElementById(divnav).className = "normal_link";			
		}	
		
		if(primary != 0){
			var divid = "subnav_div"+primary;
			document.getElementById(divid).style.display = "none";
		}
		var divid = "subnav_div"+id;
		document.getElementById(divid).style.display = "block";
		var linkid = "primarylink_"+id;
		document.getElementById(linkid).className = "hover_link";
	//}
}

var primarySubSub = 0;
var timeoutSub;
function showSubnavUl(id,id2){
	clearTimeout(timeoutSub);
	for(var cnt=1;cnt<=13;cnt++){
		var dividx = "subnavUlSub"+cnt;
		document.getElementById("subnav_lia"+cnt).className = '';
		document.getElementById(dividx).style.display = "none";
	}	
	if(primarySubSub != id){
		primarySubSub = id;
		$("#subnavUlSub"+id).fadeIn(500, function () { });
	}
	else{
		document.getElementById("subnavUlSub"+id).style.display = "block";	
	}
}

function hideSubnavUl(id){
	timeoutSub = setTimeout('hideSubnavUl1('+id+')',50);
}
function hideSubnavUl1(id){
	primarySubSub = 0;	
	document.getElementById("subnav_lia"+id).className = '';
	$("#subnavUlSub"+id).fadeOut(500, function () { });
}

function changeClassSub(id){
	clearTimeout(timeoutSub);
	document.getElementById("subnav_lia"+id).className = 'subnav_aSub';
}

function hide_subdiv(id){
	timeOut = setTimeout('hide_subdivNow('+id+')',1500);
}

function hide_subdivNow(id){
	//if(primary != id){
		for(var cnt=1;cnt<=6;cnt++){
			var dividx = "subnav_div"+cnt;
			document.getElementById(dividx).style.display = "none";
		}		
		if(id != 0){
		var divid = "subnav_div"+id;
		//setTimeout('hide_subdivNow('+divid+')', 3000)
		document.getElementById(divid).style.display = "none";
		}
		var linkid = "primarylink_"+id;
		document.getElementById(linkid).className = "normal_link";
		if(primary != 0){
			var divid = "subnav_div"+primary;
			//document.getElementById(divid).style.display = "block";
			$("#"+divid).fadeIn(500, function () { });
		}
		var divnav = "primarylink_"+primary;
		document.getElementById(divnav).className = "primary_link";
	//}
}

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	  {	// code for IE7+, Firefox, Chrome, Opera, Safari
	  	return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {	// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
}

function GetXmlHttpObject_eccp()
{
	if (window.XMLHttpRequest)
	  {	// code for IE7+, Firefox, Chrome, Opera, Safari
	  	return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {	// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
}

function GetXmlHttpObject_cb()
{
	if (window.XMLHttpRequest)
	  {	// code for IE7+, Firefox, Chrome, Opera, Safari
	  	return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {	// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
}

function GetXmlHttpObject_x()
{
	if (window.XMLHttpRequest)
	  {	// code for IE7+, Firefox, Chrome, Opera, Safari
	  	return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {	// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
}

function stateChanged_market()
{
   if (xmlhttp_market.readyState==4){
	   	if(xmlhttp_market.responseText != ''){
			document.getElementById('market_change').innerHTML = xmlhttp_market.responseText;
			setTimeout("change_market()",2000);
		}
		else{
			change_market_back();
		}
   }
}

function stateChanged_market_back()
{
   if (xmlhttp_market.readyState==4){
	   	document.getElementById('market_change').innerHTML = xmlhttp_market.responseText;
		setTimeout("change_market()",2000);
   }
}

function change_market(){
	xmlhttp_market = GetXmlHttpObject();
	if (xmlhttp_market==null){
		alert ("Your browser does not support AJAX!");
		return;
	}
	  
	url = base_url_market+"market_change";
	//alert(url);
	xmlhttp_market.onreadystatechange = stateChanged_market;
	xmlhttp_market.open("GET",url,true);
	xmlhttp_market.send(null);
}

function change_market_back(){
	xmlhttp_market = GetXmlHttpObject();
	if (xmlhttp_market==null){
		alert ("Your browser does not support AJAX!");
		return;
	}
	  
	url = base_url_market+"market_change_back";
	//alert(url);
	xmlhttp_market.onreadystatechange = stateChanged_market_back;
	xmlhttp_market.open("GET",url,true);
	xmlhttp_market.send(null);
}

function close_popup_corporate(){
	document.getElementById('popup_block').style.display = "none";	
	document.getElementById('popup_corporate_holder').style.display = "none";
	for(var cnt=1;cnt<=6;cnt++){
		var nav_corp_popup = "corporate_popup"+cnt;
		document.getElementById(nav_corp_popup).style.display = "none";	
	}
}

function open_popup_manager_application(){day = new Date();
	id = day.getTime();
	URL = "http://"+window.location.hostname+"/index.php/products_and_services/show_manager_appForm";
	
	
	var leftx = (screen.width/2)-(785/2);
	var topx = (screen.height/2)-(585/2);	
	eval("page"+id+"=window.open(URL,'"+id+"','toolbar=0,scrollbars=0,location=1,status=1,menubar=0,resizable=0,width=785px,height=585px,top="+topx+",left="+leftx+"');");
}

function close_popup_manager_application(){
	document.getElementById('popup_manager_form_content').scrollTop = 0;
	document.getElementById('loading_validation').style.display = "none";
	document.getElementById('popup_success_holder_manager_application').style.display = "none";
	document.getElementById('popup_manager_application').style.display = "none";
	document.getElementById('popup_block').style.display = "none";	
	
}

function close_popup_error(){
	document.getElementById('popup_block').style.display = "none";
	document.getElementById('popup_error_holder').style.display = "none";
}

function close_popup_errorN(){
	document.getElementById('popup_block').style.display = "none";
	document.getElementById('popup_error_holder').style.display = "none";
	document.getElementById('popup_success_holder').style.display = "none";
}
function close_popup_error_manager_application(){
	document.getElementById('popup_error_holder_manager_application').style.display = "none";
}

function close_popup_success_manager_application(){
	document.getElementById('popup_success_holder_manager_application').style.display = "none";
}

function show_light_window_corporate(id){
	$("#popup_block").fadeIn(300, function () { });
	var nav_corp_popup = "corporate_popup"+id;
	document.getElementById('popup_corporate_holder').style.display = "block";
	document.getElementById(nav_corp_popup).style.display = "block";
}

function stateChanged_cb(){
	if (xmlhttp_cb.readyState!=4){
	   	document.getElementById('cb_graph_content').innerHTML = "";
   	}
	if (xmlhttp_cb.readyState==4){
	   	document.getElementById('cb_graph_content').innerHTML = xmlhttp_cb.responseText;
   	}
}

function show_light_window_cb_rate(curid,country){
	document.getElementById('rna_central_bank_rate_world_major_contentxx').style.display = "none";	
	$("#popup_block").fadeIn(300, function () { });
	document.getElementById('popup_manager_application').style.display = "block";
	
	xmlhttp_cb=GetXmlHttpObject_cb();
	if (xmlhttp_cb==null)
	  {
	  alert ("Browser does not support HTTP Request");
	  return;
	  }
	
	var url = base_url_rna + "cb_graph_detail";
	url=url+"/"+ curid+"/"+country;
	xmlhttp_cb.onreadystatechange=stateChanged_cb;
	xmlhttp_cb.open("GET",url,true);
	xmlhttp_cb.send(null);
}

function close_light_window_cb_rate(){
	document.getElementById('popup_block').style.display = "none";
	document.getElementById('rna_central_bank_rate_world_major_contentxx').style.display = "block";
	document.getElementById('popup_manager_application').style.display = "none";	
}

function show_notice(){
	$("#popup_block").fadeIn(300, function () { });
	
	document.getElementById('popup_copyright_conv_main').style.display = "block";	
	if(document.getElementById('rna_central_bank_rate_world_major_contentxx') != null){
		document.getElementById('rna_central_bank_rate_world_major_contentxx').style.display = "none";		
	}
	document.getElementById('title_graph_curr_convx').innerHTML = "PSS FOREX Notice";
	document.getElementById('popup_curr_p').innerHTML = "Private Scandinavian Sparkasse and Trust, Ef. and Nordic Financial, LLC are acquired by PSS Trust and Credit Corp., HB. in accordance to the recent Banks and Financial Companies Reform Act. Therefore, PSS Trust and Credit Corp., HB. carries out all operations of Private Scandinavian Sparkasse and Trust, Ef. and Nordic Financial, LLC. In addition, all contracts and guarantees with and by Private Scandinavian Sparkasse and Trust, Ef. and Nordic Financial, LLC will be honored and guaranteed by PSS Trust and Credit Corp., HB. For additional inquiries, please contact our Investors Relation Hotline, + 46.(0)8.559.22.127.";
}

function show_notice2(){
	$("#popup_block").fadeIn(300, function () { });
	$("div.season-greetings-holder").show();
	document.getElementById('season-greetings-holder').style.display = "block";
}

function close_season_div(){
	$("div.season-greetings-holder").hide();
	$("#popup_block").fadeOut(300, function () { });	
}

function show_light_copyright(){
	$("#popup_block").fadeIn(300, function () { });
	document.getElementById('popup_copyright_conv_main').style.display = "block";	
	if(document.getElementById('rna_central_bank_rate_world_major_contentxx') != null){
		document.getElementById('rna_central_bank_rate_world_major_contentxx').style.display = "none";		
	}
	document.getElementById('title_graph_curr_convx').innerHTML = "PSS FOREX Copyright";
	document.getElementById('popup_curr_p').innerHTML = "Copyright in the information contained in this website subsists through international treaties and the laws of many countries. It is owned by PrivateScandinavian Holding Co., Ltd. unless otherwise stated. You may download a single copy of this document and make a single hard copy, where necessary for its use as a reference. Except as permitted by applicable laws, no part of this publication may be otherwise reproduced, adapted, performed in public or transmitted in any form by any process (graphic, electronic or mechanical, including photocopying, recording, taping or by storage in an information retrieval system) without the specific written consent of Private Scandinavian Holdings Co., Ltd. &copy; 2010 Private Scandinavian Holding Co., Ltd. All rights reserved.";
}

function close_light_copyright(){
	document.getElementById('popup_copyright_conv_main').style.display = "none";
	document.getElementById('popup_block').style.display = "none";		
	if(document.getElementById('rna_central_bank_rate_world_major_contentxx') != null){
		document.getElementById('rna_central_bank_rate_world_major_contentxx').style.display = "block";		
	}
	
	var timeout = setTimeout("show_light_newsletterReg()",10000);
}

function show_light_demoreg(){
	$("#popup_opacity").show();
	$("#popup_block").fadeIn(300, function () { });
	document.getElementById('demo_reg_conv_main').style.display = "block";	
	if(document.getElementById('rna_central_bank_rate_world_major_contentxx') != null){
		document.getElementById('rna_central_bank_rate_world_major_contentxx').style.display = "none";		
	}
}

function show_light_newsletterReg(){
	$("#demo_reg_conv_main").hide();
	$("#popup_opacity").hide();
	$("#popup_block").show();
	$(".newsletterPopupHolder").slideDown(300, function () { });
}

function close_light_newsletterReg(){
	$(".newsletterPopupHolder").fadeOut(300, function () { });
	$("#popup_opacity").show();
	$("#popup_block").hide();
}

function close_light_demoreg(){
	document.getElementById('demo_reg_conv_main').style.display = "none";
	document.getElementById('popup_block').style.display = "none";		
	if(document.getElementById('rna_central_bank_rate_world_major_contentxx') != null){
		document.getElementById('rna_central_bank_rate_world_major_contentxx').style.display = "block";		
	}
	if(xmlhttp_demo_applicationx){
		xmlhttp_demo_applicationx.abort();
		document.getElementById('popup_error_demoreg_holder').style.display = "none";
	}
}

function check_state2(){
	var country = document.getElementById("dcountryx").value;
	
	if(country == "United States"){
		document.getElementById("dstatex").disabled=false;	
	}
	else{
		document.getElementById("dstatex").disabled=true;	
		document.getElementById('dstatex').options[0].selected = "1"; 	
	}
}

function stateChanged_demo_applicationx(){
	if (xmlhttp_demo_applicationx.readyState!=4){
		$("#popup_block").fadeIn(300, function () { });
		document.getElementById('loading_intro2').style.display = "block";
		document.getElementById('popup_error_demoreg_holder').style.display = "none";
		document.getElementById('popup_success_holder_demoreg').style.display = "none";
	}
   	if (xmlhttp_demo_applicationx.readyState==4){
		var chck_return = xmlhttp_demo_applicationx.responseText;
		
		if(chck_return == "Success" || chck_return.search("Success") != -1){
			document.getElementById('popup_error_demoreg_holder').style.display = "none";
			document.getElementById('loading_intro2').style.display = "none";
			document.getElementById('popup_success_holder_demoreg').style.display = "block";
			
			document.getElementById("dnamex").value = '';
			document.getElementById("demailx").value = '';
			document.getElementById("dphonex").value = '';
			document.getElementById("daddressx").value = '';
			document.getElementById("dcityx").value = '';
			document.getElementById("dzipx").value = '';
		}
		else{
			document.getElementById('popup_error_demoreg_holder').style.display = "block";
			document.getElementById('loading_intro2').style.display = "none";
			document.getElementById('popup_success_holder_demoreg').style.display = "none";
			document.getElementById('error_content_p').innerHTML = xmlhttp_demo_applicationx.responseText+"<br>";
		}
	}	
}

function validate_demo_regx(){
	xmlhttp_demo_applicationx = GetXmlHttpObject();
	var dname = document.getElementById("dnamex").value;
	var demail = document.getElementById("demailx").value;
	var dphone = document.getElementById("dphonex").value;
	var daddress = document.getElementById("daddressx").value;
	var dcountry = document.getElementById("dcountryx").value;
	var dstate = document.getElementById("dstatex").value;
	var dcity = document.getElementById("dcityx").value;
	var dzip = document.getElementById("dzipx").value;
	var dleverage = document.getElementById("dleveragex").value;
	var ddeposit = document.getElementById("ddepositx").value;
	
	if (xmlhttp_demo_applicationx==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	
	var poststr = "dname=" + encodeURI( dname )+
					"&demail=" + encodeURI( demail )+
					"&dphone=" + encodeURI( dphone )+
					"&daddress=" + encodeURI( daddress )+
					"&dcountry=" + encodeURI( dcountry )+
					"&dstate=" + encodeURI( dstate )+
					"&dcity=" + encodeURI( dcity )+
					"&dzip=" + encodeURI( dzip )+
					"&dleverage=" + encodeURI( dleverage )+
					"&ddeposit=" + encodeURI( ddeposit );
	
	url = base_url_tpSSL + "demo_validation";
	
	xmlhttp_demo_applicationx.onreadystatechange = stateChanged_demo_applicationx;
	xmlhttp_demo_applicationx.open("POST",url,true);
	xmlhttp_demo_applicationx.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp_demo_applicationx.setRequestHeader("Content-length", poststr.length);
	xmlhttp_demo_applicationx.setRequestHeader("Connection", "close");
	xmlhttp_demo_applicationx.send(poststr);
}

function validate_demo_regMain(){
	xmlhttp_demo_applicationx = GetXmlHttpObject();
	var dname = document.getElementById("dnamex").value;
	var demail = document.getElementById("demailx").value;
	var dphone = document.getElementById("dphonex").value;
	var daddress = document.getElementById("daddressx").value;
	var dcountry = document.getElementById("dcountryx").value;
	var dstate = document.getElementById("dstatex").value;
	var dcity = document.getElementById("dcityx").value;
	var dzip = document.getElementById("dzipx").value;
	var dleverage = document.getElementById("dleveragex").value;
	var ddeposit = document.getElementById("ddepositx").value;
	
	if (xmlhttp_demo_applicationx==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	
	var poststr = "dname=" + encodeURI( dname )+
					"&demail=" + encodeURI( demail )+
					"&dphone=" + encodeURI( dphone )+
					"&daddress=" + encodeURI( daddress )+
					"&dcountry=" + encodeURI( dcountry )+
					"&dstate=" + encodeURI( dstate )+
					"&dcity=" + encodeURI( dcity )+
					"&dzip=" + encodeURI( dzip )+
					"&dleverage=" + encodeURI( dleverage )+
					"&ddeposit=" + encodeURI( ddeposit );
	
	url = base_url_tp + "demo_validation";
	
	xmlhttp_demo_applicationx.onreadystatechange = stateChanged_demo_applicationx;
	xmlhttp_demo_applicationx.open("POST",url,true);
	xmlhttp_demo_applicationx.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp_demo_applicationx.setRequestHeader("Content-length", poststr.length);
	xmlhttp_demo_applicationx.setRequestHeader("Connection", "close");
	xmlhttp_demo_applicationx.send(poststr);
}

function close_popup_error_demo(){
	document.getElementById('popup_error_demoreg_holder').style.display = "none";
}

function close_popup_error_demo2(){
	document.getElementById('popup_success_holder_demoreg').style.display = "none";
}


function popUp_livechat()
{
	var left = (screen.width/2)-(820/2);
	var top = (screen.height/2)-(620/2);
	day = new Date();
	iddate = day.getTime(); //http://pssforex.com/psslivechat/main/client
	window.open('https://pssforex.com/livechat.cpanel/index.php/main/client', iddate,'toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=820px,height=620px,top='+top+',left='+left);
	
}

function showCopyright(linkx){
	var leftx = (screen.width/2)-(770/2);
	var topx = (screen.height/2)-(390/2);
	
	window.open('http://'+window.location.hostname+'/index.php/main/copyright','','toolbar=0,scrollbars=1,top=0,location=0,status=1,menubar=0,resizable=0,width=770,height=390,top='+topx+',left='+leftx);
}

function stateChanged_updates(){
	if (xmlhttp_updates.readyState!=4){
		$("#popup_block").fadeIn(300, function () { });
		document.getElementById('loading_intro').style.display = "block";
		document.getElementById('popup_error_holder').style.display = "none";
		document.getElementById('popup_success_holder').style.display = "none";
		document.getElementById('popup_success_holder_demo').style.display = "none";
	}
   	if (xmlhttp_updates.readyState==4){
		var chck_return = xmlhttp_updates.responseText;
		
		if(chck_return == "Success" || chck_return.search("Success") != -1){
			document.getElementById('popup_error_holder').style.display = "none";
			document.getElementById('loading_intro').style.display = "none";
			document.getElementById('popup_success_holder').style.display = "block";
			document.getElementById('popup_success_holder_demo').style.display = "none";
			document.getElementById('success_content_pN').innerHTML = '<font style="font-size: 14px; font-weight: bold;">Request Successfully Submitted</font><br /><font style="font-size: 11px;">A confirmation Email was sent to '+txtEmail+'</font><br /><br />';
			
			document.getElementById("txtName").value = '';
			document.getElementById("txtEmail").value = '';
		}
		else{
			document.getElementById('popup_error_holder').style.display = "block";
			document.getElementById('loading_intro').style.display = "none";
			document.getElementById('popup_success_holder').style.display = "none";
			document.getElementById('popup_success_holder_demo').style.display = "none";
			document.getElementById('erro_content_p').innerHTML = xmlhttp_updates.responseText+"<br>";
		}
	}	
}

var txtEmail = '';
function validate_newsletter(){
	xmlhttp_updates = GetXmlHttpObject();
	var txtName = document.getElementById("txtName").value;
	txtEmail = document.getElementById("txtEmail").value;
	
	if (xmlhttp_updates==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	
	var poststr = "txtName=" + encodeURI( txtName )+
					"&txtEmail=" + encodeURI( txtEmail );
	
	url = base_url_tp + "updates_validation";
	
	xmlhttp_updates.onreadystatechange = stateChanged_updates;
	xmlhttp_updates.open("POST",url,true);
	xmlhttp_updates.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp_updates.setRequestHeader("Content-length", poststr.length);
	xmlhttp_updates.setRequestHeader("Connection", "close");
	xmlhttp_updates.send(poststr);
}

function stateChanged_updates2(){
	if (xmlhttp_updates.readyState!=4){
		$("p#loadingNewsletterP").show();
	}
   	if (xmlhttp_updates.readyState==4){
		var chck_return = xmlhttp_updates.responseText;
		
		if(chck_return == "Success" || chck_return.search("Success") != -1){
			$("div#newsletterError").hide();
			$("div#newsletterSuccess").slideDown(300, function () { });
			document.getElementById('newsletterSuccess').innerHTML = '<font style="font-size: 14px; font-weight: bold;">Request Successfully Submitted</font><br /><font style="font-size: 11px;">A confirmation Email was sent to '+txtEmail+'</font>';
			
			document.getElementById("newsletterName").value = '';
			document.getElementById("newsletterEmail").value = '';
			document.getElementById("noThanksHolder").innerHTML = 'Close';
			$("p#loadingNewsletterP").hide();
		}
		else{
			$("div#newsletterSuccess").hide();
			$("div#newsletterError").slideDown(300, function () { });
			document.getElementById('newsletterError').innerHTML = xmlhttp_updates.responseText;
			$("p#loadingNewsletterP").hide();
		}
	}	
}

function validate_newsletter2(){
	xmlhttp_updates = GetXmlHttpObject();
	var txtName = document.getElementById("newsletterName").value;
	txtEmail = document.getElementById("newsletterEmail").value;
	
	if (xmlhttp_updates==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	
	var poststr = "txtName=" + encodeURI( txtName )+
					"&txtEmail=" + encodeURI( txtEmail );
	
	url = base_url_tp + "updates_validation";
	
	xmlhttp_updates.onreadystatechange = stateChanged_updates2;
	xmlhttp_updates.open("POST",url,true);
	xmlhttp_updates.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp_updates.setRequestHeader("Content-length", poststr.length);
	xmlhttp_updates.setRequestHeader("Connection", "close");
	xmlhttp_updates.send(poststr);
}
var primaryQuotes = 1;
/*
function changeQuotes(id){
	
	if(id == 1){
		if(primaryQuotes != 1){
			for(var cnt=1;cnt<=9;cnt++){
				var nameQuotes = 'quotesHolderResult'+cnt;
				document.getElementById(nameQuotes).style.display = "none";
			}
			primaryQuotes = primaryQuotes-1;	
			var nameQuotes = 'quotesHolderResult'+primaryQuotes;
			$("#"+nameQuotes).fadeIn(500, function () { });
		}
	}
	else{
		if(primaryQuotes != 9){
			for(var cnt=1;cnt<=9;cnt++){
				var nameQuotes = 'quotesHolderResult'+cnt;
				document.getElementById(nameQuotes).style.display = "none";
			}
			primaryQuotes = primaryQuotes+1;	
			var nameQuotes = 'quotesHolderResult'+primaryQuotes;
			$("#"+nameQuotes).fadeIn(500, function () { });
		}
	}
}
*/

function changeQuotes(){
	if(primaryQuotes != 9){
		primaryQuotes = primaryQuotes+1;	
	}
	else{
		primaryQuotes = 1;		
	}
	
	for(var cnt=1;cnt<=9;cnt++){
		var nameQuotes = 'quotesHolderResult'+cnt;
		document.getElementById(nameQuotes).style.display = "none";
	}
	
	var nameQuotes = 'quotesHolderResult'+primaryQuotes;
	$("#"+nameQuotes).fadeIn(500, function () { });
	
	setTimeout('changeQuotes()',10000);
}

function stateChanged_marketQuotes()
{
   if (xmlhttp_market.readyState==4){
	   	if(xmlhttp_market.responseText != ''){
			var returnValue = xmlhttp_market.responseText;
			var returnValue2 = returnValue.split('|');
			
			document.getElementById('dateHolderDiv').innerHTML = returnValue2[0];
			//document.getElementById('market_changeLoad').innerHTML = returnValue2[1];
			
			var className;
			className = 'market_changeLoadClass';
			var elements = new Array();
			var elements = document.getElementsByTagName('div');
			for (var e = 0; e < elements.length; e++){
				if (elements[e].className == className) {
					var newHTML = elements[e].innerHTML;
					elements[e].innerHTML = returnValue2[1];
				}
			}
			setTimeout("marketQuotes()",2000);
		}
		else{
			setTimeout("marketQuotes()",2000);
		}
   }
}

//window.onload = marketQuotes();
function marketQuotes(){
	xmlhttp_market = GetXmlHttpObject();
	if (xmlhttp_market==null){
		alert ("Your browser does not support AJAX!");
		return;
	}
	  
	url = base_url_market+"market_change";
	//alert(url);
	xmlhttp_market.onreadystatechange = stateChanged_marketQuotes;
	xmlhttp_market.open("GET",url,true);
	xmlhttp_market.send(null);
}

function changeDateQuotes(nDate){
	document.getElementById('dateHolderDiv').innerHTML = nDate;
}

//window.onload = marketQuotes;

function showContactUsForm(){
	var leftx = (screen.width/2)-(420/2);
	var topx = (screen.height/2)-(466/2);
	
	window.open('http://'+window.location.hostname+'/index.php/tradingplatform/contact_us_pop','','toolbar=0,scrollbars=1,top=0,location=0,status=1,menubar=0,resizable=0,width=420,height=466,top='+topx+',left='+leftx);
}

var tick;
function stop() {
	clearTimeout(tick);
}
function usnotime(day,h,m,s){
	var ut=new Date();
	var h,m,s;
	var time="";
	
	if(s==59){ 
		s = 0;
		if(m == 59){
			m = 0;
			if(h == 23){
				m = 0;	
			}
			else{
				h = h+1	
			}
		}
		else{
			m = m+1;	
		}
	}
	else{
		s = s+1;	
	}
	
	tick=setTimeout("usnotime('"+day+"',"+h+","+m+","+s+")",1000); 
	
	if(s<=9) s="0"+s;
	if(m<=9) m="0"+m;
	if(h<=9) h="0"+h;
	time+=h+":"+m+":"+s + " GMT +1";
	$('div#dateHolderDiv').html(day+' '+time);      
}

function load_hidden_images(){
	$.ajax({
		type:"POST",
		url:base_url_market+"load_images",
		success:function(msg){
			$("div.load-images-hidden").html(msg);
		}
	})
}

function load_quotes_major(){
	$.ajax({
		type:"POST",
		url:base_url_market+"quotes_major",
		success:function(msg){
			$("div#market_change").html(msg);
		}
	})
}
