Ext.BLANK_IMAGE_URL = 'img/s.gif';
var contentWidth = 962; 
var loadedWidth;
if (screen.availWidth < 1280) {
	loadCss('./css/1024.css');
	loadedWidth = 1024;
	contentWidth = 818;	
	if (screen.availHeight <= 800)
		contentWidth = 736;		
} else if (screen.availWidth < 1440) {
	loadCss('./css/1280.css');
	loadedWidth = 1280;
	contentWidth = 818;
	if (screen.availHeight <= 800)
		contentWidth = 736;		
} else if ( screen.availWidth < 1600){
	loadCss('./css/1440.css');
	loadedWidth = 1440;
	}
else 
{
	loadCss('./css/1680.css');
	loadedWidth = 1680;
}

var cssheight = 1080;
if (screen.availHeight <= 800){
	cssheight = 800;	
}
else if (screen.availHeight <= 1024)
{
	cssheight = 1024;
	if ( screen.height == 1024 && screen.width == 1280 )
	{
		//contentWidth = 985;
		//loadedWidth = 1440;
		//loadCss('./css/1440.css');
	}
}

include('js/overrides.js');
include('js/header.js');
include('js/footer.js');

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16866835-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

Ext.onReady(function() {
	Ext.QuickTips.init();
	
	var viewport = new Ext.Viewport(
			{
				layout : 'border',
				cls : 'canvas h' + cssheight,
				defaults: {
					unstyled: true  			    
				},
				items : [
						{
							region : 'north',
							height : 50,
							border : false,
							bodyCssClass : 'header',
							layout : 'ux.center',
							items:[{
					    	   xtype: 'vd_header',
					    	   width: contentWidth,
					    	   layout: 'fit',
					    	   unstyled: true
							}]
						}, {
							region : 'center',
							border : false,
							layout : 'ux.center',
							cls: 'center',
							items:[{
					    	   xtype: 'vd_center',
					    	   width: contentWidth,
					    	   unstyled: true					    	  
							}/*,{
								xtype: 'box',
								id: 'support',
								autoEl: {
									html: '<a href="#"><img src="http://d33yedrtgjxwfm.cloudfront.net/visualdomains/img/img/btn/btn-support.png"></img></a>',
									style: 'position: absolute; top: 40px; right: 0px'
								}
							}*/]
						}, {
							region : 'south',
							bodyCssClass : 'footer',
							cls : 'footer',
							height : 20,
							border : false,
							layout : 'ux.center',
							items:[{
					    	   xtype: 'vd_footer',
					    	   width: contentWidth,
					    	   unstyled: true
							}]
						} ]
			}).doLayout();
	
	if (typeof(PostLoad) != 'undefined') PostLoad.call(this);
	
	if (Ext.isIE6)
	{
		for(var i=0; i<document.images.length; i++)
	    {	 
		  var img = document.images[i];
		  var imgName = img.src.toUpperCase();
		  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		  {
			 var imgID = (img.id) ? "id='" + img.id + "' " : "";
			 var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			 var imgStyle = "display:inline-block;" + img.style.cssText;
			 if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			 if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
			 
			 var strNewHTML = "<span " + imgID + imgClass + imgTitle
			 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			 img.outerHTML = strNewHTML;
			 i = i-1;
		  }
		}
	}
});



var popupStatus = 0;

function contact(){

var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#w_cu").height();   
var popupWidth = $("#w_cu").width(); 

$("#loading_status").fadeOut("slow");

if(popupStatus==0){   
	$("#backgroundPopup").css({   
		"opacity": "0.2"  
	});   
	$("#backgroundPopup").fadeIn("slow");   
	$("#w_cu").fadeIn("slow");   
	popupStatus = 1; 
	


$("#w_cu").fadeIn("slow");
$("#w_cu").css({   
"z-index": "10000",   
"top": windowHeight/2-popupHeight/2,   
"left": windowWidth/2-popupWidth/2
});  


}else if(popupStatus==1){   
				$("#backgroundPopup").fadeOut("slow");   
				$("#w_cu").fadeOut("slow");   
				popupStatus = 0;   
			}




$(document).keypress(function(e){   
		if(e.keyCode==27 && popupStatus==1){   
			$("#backgroundPopup").fadeOut("slow");   
				$("#w_cu").fadeOut("slow");   
				popupStatus = 0; 
		}   
	});


}






var t_popupStatus = 0;

function troubleshoot(){

var t_windowWidth = document.documentElement.clientWidth;
var t_windowHeight = document.documentElement.clientHeight;
var t_popupHeight = $("#qts").height();   
var t_popupWidth = $("#qts").width(); 



if(t_popupStatus==0){   
	
	
	$("#backgroundPopup").css({   
		"opacity": "0.2"  
	});   
	$("#backgroundPopup").fadeIn("slow");   
	
	
	$("#qts").fadeIn("slow");   
	t_popupStatus = 1; 
	


$("#qts").fadeIn("slow");
$("#qts").css({   
"z-index": "10000",   
"top": t_windowHeight/2-t_popupHeight/2,   
"left": t_windowWidth/2-t_popupWidth/2
});  


}else if(t_popupStatus==1){   
				$("#backgroundPopup").fadeOut("slow");   
				$("#qts").fadeOut("slow");   
				t_popupStatus = 0;   
			}




$(document).keypress(function(e){   
		if(e.keyCode==27 && t_popupStatus==1){   
			$("#backgroundPopup").fadeOut("slow");   
				$("#qts").fadeOut("slow");   
				t_popupStatus = 0; 
		}   
	});



$(document).ready(makeScroll);
}











function M(t){
	return document.getElementById(t);
};

function show(id){
var d = 'f';
var t = 'm_f';

/*
for(i=1; i<=5; i++){
M(d+i).style.display = 'none';
M(t+i).className = 'f_faq_form_con_li1';
}
*/
var K = M(id).style.display;

if(K=='none'){
	M(id).style.display = 'block';
	M('m_'+id).className = 'faq_title_j';
}else{
	M(id).style.display = 'none';
	M('m_'+id).className = 'faq_title_s';
}

}

function sub_s(sub_id){
var sm = M(sub_id).style.display;

if(sm=='none'){
	M(sub_id).style.display = 'block';
	M('t_'+sub_id).className = 'faq_title_j';
}else{
	M(sub_id).style.display = 'none';
	M('t_'+sub_id).className = 'faq_title_s';
}



}


function to_mail(){

var q = M('f_sq_input_text').value;
var name = M('f_sq_name_text').value;
var email = M('f_sq_email_text').value;
var position = document.getElementsByName('position');

var pos_var;

for (j=0;j<position.length;j++){
if(position[j].checked){
	pos_var = position[j].value;
	}
}

$.ajax({

    type: "POST",

    url: "http://62.219.78.114/visualdomainsco/mail.php",

    data: "action=faq&q="+q+"&p="+pos_var+"&n="+name+"&e="+email,



    success: function(msg){

		if(msg=="OK"){
		alert("Thank you for your email");
		}

    }

});



 }


function contactus(){

var ms = M('w_cu_input_text').value;
var n = M('w_cu_send_input_text1').value;
var e = M('w_cu_send_input_text2').value;
var p = document.getElementsByName('pos');

var p_var;



for (j=0;j<p.length;j++){
if(p[j].checked){
	p_var = p[j].value;
	}
}

//$("#loading_status").fadeIn("slow");

$.ajax({

    type: "POST",

    url: "http://62.219.78.114/visualdomainsco/mail.php",

    data: "action=msg&q="+ms+"&p="+p_var+"&n="+n+"&e="+e,
	
	


    success: function(msg){

		if(msg=="OK"){
		$("#loading_status").fadeOut("slow");
		alert("Thank you for your email");
		contact();
		}



	}






});



 }


