var config_path_site = "/";
$(document).ready(function () 
{
		document.getElementById("newsTicker").style.display = "";
		$(".newsTicker").jCarouselLite({
			vertical: false,
			hoverPause:true,
			visible: 1,
			auto:800,
			speed:15000
		});
	clearOnFocus();
	highlightPartners();
	highlightDetailsTable();
	hideMsg();
});

function clearOnFocus()
{
	$(".clearFocus").focus(
		function()
		{
			if($(this).attr("title") == $(this).attr("value"))
			{
				$(this).attr("value", "");
			}
		}
	);
	$(".clearFocus").blur(
		function()
		{
			if($(this).attr("value") == "")
			{
				$(this).attr("value", $(this).attr("title"));
			}
		}
	);
}

function setPaths(sitePath)
{
	config_path_site = sitePath;
}

function hideMsg()
{
	$('.msg_warning,.msg_error,.msg_info,.msg_general').click(
		function()
		{
			$(this).fadeOut("slow");
		}
	);
	window.setTimeout('autoHideMsg()',6000);
}


function highlightPartners()
{
	$(".partners").find("img:first").css("opacity","0.5");
	$(".partners").hover(
		function () {
			$(".partners").css("border-color","#DDDDDD");
			$(".partners").find("img:first").css("opacity","0.5");
			
			$(this).find("img:first").animate({opacity: "1"},"fast" );
			$(this).css("border-color","#888888");
		}, 
		function () {
			$(this).find("img:first").animate({opacity: "0.5"},"slow" );
			$(this).css("border-color","#DDDDDD");
		}
	);
}

function highlightDetailsTable()
{
	$("Table.details tr").hover(
		function () {
			if($(this).find("td"))
			{
				$(this).css("background-color","#EEEEEE");
			}
		}, 
		function () {
			if($(this).find("td"))
			{
				$(this).css("background-color","");
			}
		}
	);
}

function show_pass_veri()
{
	tempHTML = $("#result").html();
	
	varPPNo = $('#pp_no').attr("value");
	varPPNoTitle = $('#pp_no').attr("title");
	if(varPPNo == "" || varPPNo == varPPNoTitle)
	{
		alert("Please Enter Your Passport Verification Number.");
		return;
	}

	$("#result").html('<div style="padding:10px 10px 10px 10px; background-color:#FF7000; color:#FFFFFF; font-family:Arial; font-size:18px;-moz-border-radius:4px;">Please wait...</div>');
	
	
	randNum = Math.random()*100;
	$.ajax({
	   type: "GET",
	   url: config_path_site + "_ajax_services-passport-verification.do",
	   data: "rand=" + randNum + "&ppno=" + varPPNo,
		   error: function(){
			 alert("Can't complete process at present please try after some time!");
			 $("#result").html(tempHTML);
		   },
	   success: function(msg){
		   $("#result").html(msg);
		   highlightDetailsTable();
		   
	   }
	 });
}

function show_arm_status()
{
	tempHTML = $("#result").html();
	
	varLicType = $('#lic_type').attr("value");
	
	varFormNo = $('#form_no').attr("value");
	varFormNoTitle = $('#form_no').attr("title");
	
	if(varFormNo == "" || varFormNo == varFormNoTitle)
	{
		alert("Please Enter Form/License Number.");
		return;
	}

	$("#result").html('<div style="padding:10px 10px 10px 10px; background-color:#FF7000; color:#FFFFFF; font-family:Arial; font-size:18px;-moz-border-radius:4px;">Please wait...</div>');
	
	
	randNum = Math.random()*100;
	$.ajax({
	   type: "GET",
	   url: config_path_site + "_ajax_services_arm_license.do",
	   data: "rand=" + randNum + "&lic_type=" + varLicType + "&form_no=" + varFormNo,
		   error: function(){
			 alert("Can't complete process at present please try after some time!");
			 $("#result").html(tempHTML);
		   },
	   success: function(msg){
		   $("#result").html(msg);
		   highlightDetailsTable();
		   
	   }
	 });
}

function show_pcc()
{
	tempHTML = $("#result").html();
	
	varCPRCNo = $('#cprc_no').attr("value");
	varCPRCNoTitle = $('#cprc_no').attr("title");
	varPCCKey = $('#pcc_key').attr("value");
	varPCCKeyTitle = $('#pcc_key').attr("title");
	varYear = $('#year').attr("value");
	varYearTitle = $('#year').attr("title");
	if(varCPRCNo == "" || varCPRCNo == varCPRCNoTitle)
	{
		alert("Please Enter Your CPRC Number.");
		return;
	}
	if(varPCCKey == "" || varPCCKey == varPCCKeyTitle)
	{
		alert("Please Enter Your PCC Key.");
		return;
	}
	if(varYear == "" || varYear == varYearTitle)
	{
		alert("Please Enter Year Of Submisson");
		return;
	}

	$("#result").html('<div style="padding:10px 10px 10px 10px; background-color:#FF7000; color:#FFFFFF; font-family:Arial; font-size:18px;-moz-border-radius:4px;">Please wait...</div>');
	
	
	randNum = Math.random()*100;
	$.ajax({
	   type: "GET",
	   url: config_path_site + "_ajax_services-pcc.do",
	   data: "rand=" + randNum + "&cprcno=" + varCPRCNo + "&pcc_key=" + varPCCKey + "&year=" + varYear,
		   error: function(){
			 alert("Can't complete process at present please try after some time!");
			 $("#result").html(tempHTML);
		   },
	   success: function(msg){
		   $("#result").html(msg);
		   highlightDetailsTable();
		   
	   }
	 });
}

function show_untrace()
{
	tempHTML = $("#result").html();
	
	varPS = $('#police_station').attr("value");
	varFIRNo = $('#fir_no').attr("value");
	varFIRNoTitle = $('#fir_no').attr("title");
	varYear = $('#year').attr("value");
	varYearTitle = $('#year').attr("title");
	
	if(varFIRNo == "" || varFIRNo == varFIRNoTitle)
	{
		alert("Please Enter Your FIR Number.");
		return;
	}
	if(varYear == "" || varYear == varYearTitle)
	{
		alert("Please Enter Year Of Submisson");
		return;
	}

	$("#result").html('<div style="padding:10px 10px 10px 10px; background-color:#FF7000; color:#FFFFFF; font-family:Arial; font-size:18px;-moz-border-radius:4px;">Please wait...</div>');
	
	
	randNum = Math.random()*100;
	$.ajax({
	   type: "GET",
	   url: config_path_site + "_ajax_services-ut.do",
	   data: "rand=" + randNum + "&ps=" + varPS + "&firno=" + varFIRNo + "&year=" + varYear,
		   error: function(){
			 alert("Can't complete process at present please try after some time!");
			 $("#result").html(tempHTML);
		   },
	   success: function(msg){
		   $("#result").html(msg);
		   
	   }
	 });
}


