if (typeof com === "undefined") {
    var com = {};
}
com.Init = function(){
	com.snapDefalut=0;
	com.snapSubDefalut=0;
	com.Events.snapShot();
	com.Events.snapShotSub();
	$("#docResearch").mouseenter(com.Events.documentGridShow);
	$("#docResearch").mouseleave(com.Events.documentGridShow);
	$(".document").mouseleave(com.Events.documentGridHideAll);
}
com.Events = {
	snapShot : function(){
		com.snapDefalut=com.snapDefalut+1;
		if(com.snapDefalut > com.snapTotal){
			$(".snapShot p").css("bottom","-5em");
			com.snapDefalut = 1;
		}
		$(".snapShot .set"+com.snapDefalut).animate({ 
		"bottom" : "3.5em"
		}, 1000 , com.Events.snapShotDelay); 
	},
	snapShotDelay : function(){
		setTimeout( com.Events.snapCallback,2000);
	},
	snapCallback : function(){
		$(".snapShot .set"+com.snapDefalut).animate({ 
		"bottom" : "8em"
		}, 1000,com.Events.snapShot);
	},
	snapShotSub  : function(){
		$(".snapshot_sub p").fadeOut("slow");
		com.snapSubDefalut=com.snapSubDefalut+1;
		if(com.snapSubDefalut > com.snapSubTotal){
			com.snapSubDefalut = 1;
		}
		$(".snapshot_sub .set"+com.snapSubDefalut).fadeIn("slow", com.Events.snapSubShotDelay);
	},
	snapSubShotDelay : function(){
		setTimeout( com.Events.snapShotSub,4000);
	},
	documentGridShow:function(){
		$(this).children("ul").show();
	},
	documentGridHide:function(){
		$(this).children("ul").hide();
	},
	documentGridHideAll:function(){
		setTimeout(com.Events.documentGridHideAll_1,8000);
	},
	documentGridHideAll_1:function(){
		$(".documentGrid ul").hide();
	}
}
function showcompany(arg)
{  
 $('#docCompany').html('Loading...');
 //sleep(1000);

  $("#loading").ajaxStart(function(){
  $(this).show();
  });   
  $.post('Ajax.php',{sid: $.trim(arg),hdnflag: "company"},
  function(data){  
  if(data.succes==true)
  {  
	  $('#docCompany').html(data.msg);                 
  }     
  },'json'); 
  return false; 
}

function showlayer(val){
var show = document.getElementById(val);
var getId = '';    
$(".hdnspan").each(function() {getId +=$(this).attr('id')+",";});
getId = getId.substr(0,getId.length-1); 
getId=$.trim(getId).split(","); 
if(show.style.display=="inline")
{
show.style.display="none";
}
else
{
for(i=0;i<getId.length;i++)
{  
  var hide = document.getElementById(getId[i]);
  hide.style.display="none";
}
show.style.display="inline";
} 
}

$(document).ready(function(){

/******************Show company Onload********************/
showcompany('');



$("#form_submit").click(function(){ 
var val=$("#country").val();
if(val=='')
{
  alert("Please select the country");
	$('#country').focus();  
	return false;
}
else
{
 window.open ("phpfile/disclaimer-popup.php?country="+val,"Disclaimer","height=400,width=600,top=50,left=50");
} 
});

$("#docSector select").change(function(){ 
  var sid=$(this).val();   
  showcompany(sid);   
});  
});

