// JScript source code



function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}


function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}



 function loadpicblock($page,$id,$fnname,$backDIV){
 
           if ($fnname=="product"){
		     $.get("services/loadpicblock.php",{page:$page,products_id:$id},function(data){			 
                  $("#"+$backDIV).html("<div style='float:left'>"+data+"</div>");
		     });
		   }
 }


 function mebersubmit(){
     $("#member_login").subimt();
 }


$(function(){
	$(".webgrid tr").css({'height':30});
	$(".webgrid table").css({'border':'1px solid #b8db7c','border-left':'0px'});
    $(".webgrid tr:even").css({'background-color':'#f8f8f8','border':'1px solid #c8c8c8 '});	
	$(".webgrid th").css({'border':'1px solid #c8c8c8 ','border-right':'0px','border-top':'0px'});
	$(".webgrid th:first").css({'border-right':'0px','border-left':'1px solid #b8db7c'});
	$(".webgrid th:last").css({'border-right':'1px solid #c8c8c8','border-right':'0px'});
	$(".webgrid td").css({'border':'1px solid #c8c8c8','border-top':'0px','border-right':'0px'});
	$(".webgrid td:last").css({'border':'0px','border-left':'1px solid #c8c8c8'});
    $(".prodgrid td:odd").css({'border-left':'1px solid #c8c8c8'});
	$(".buildprod").css({'border':'2px solid #b8db7c'});  
    $(".buildprod th").css({'background-color':'#fdeec4',
	                        'border-left':'2px solid #fdeec4',
							'border-bottom':'2px dashed #b8db7c',
							'height':'30px'
							});  
    $(".buildprod th").css({'border-right':'0px','width':'100px'});  
	$(".buildprod td").css({'border-left':'0px','border-bottom':'2px dashed #b8db7c','text-align':'left','height':'30px','padding-left':'5px'});  
    $(".buildprod td:last").css({'border-bottom':'0px'});  
	$("#contactblock td").css({'border-bottom':'0px'}); 
	});

    function makeblack(){
      $("#allpage").addClass("backme");
    }
	function removeblack(){
  	 $("#allpage").removeClass("backme");
	}


function jumpbig($loadDiv,$pic){
     $.get("services/loadbig.php",{picture_url:$pic},function(e){
            $("#"+$loadDiv).html(e);
	 });
}



function jumpout($loadfunction,$backdiv,$loadprogram,$param1){

//alert($picuploadtype);
       if($picuploadtype==1){
		   var heightx= document.body.scrollHeight;}
		   else{
           var heightx= document.body.scrollHeight+document.body.offsetHeight+1000;
		   }
           var offsetWidth=document.body.offsetWidth*0.8;
		   //alert(heightx);
           var offsetHeight=document.body.offsetHeight*0.8;
              
			  if(offsetHeight<"350"){
		    	  var top1=offsetHeight*0.2;
                  offsetHeight="420";
		 	  }else{
                  var top1=offsetHeight*0.2;
		      }


		   var left1=offsetWidth*0.1;
		   var $htmldata="";


 //for adjust 
           switch ($loadfunction){
			   default:           
		   		    $("#allmask").css({"opacity":"0.6","width":"100%","height":heightx,"z-index":"99"});
                    $("#popwin").css({"width":offsetWidth,"height":offsetHeight,"left":left1,"top":top1,"z-index":"100","display":""});
                    $htmldata+='<div >'; 
                    $htmldata+='<iframe  scrolling="no" frameborder="0" style="width:100%;height:450px"  src="popwin.php?kind_id='+$loadfunction+'&poptype=1&backdiv='+$backdiv+'&loadprogram='+$loadprogram+'&param1='+$param1+'&picuploadtype='+$picuploadtype+'" ></iframe>';
				    $htmldata+='</div>';
                    $("#popwin").html($htmldata);			  
               break;
			   case "maps":
	    		    $("#allmask").css({"opacity":"0.6","width":"100%","height":heightx,"z-index":"99"});
                    $("#popwin").css({"width":offsetWidth,"height":offsetHeight,"left":left1,"top":top1,"z-index":"100","display":""});
                    $htmldata+='<div >'; 
                    $htmldata+='<iframe  scrolling="no" frameborder="0" style="width:100%;height:450px"  src="popwin.php?kind_id='+$loadfunction+'&poptype=1&backdiv='+$backdiv+'&loadprogram='+$loadprogram+'&param1='+$param1+'"></iframe>';
				    $htmldata+='</div>';
                    $("#popwin").html($htmldata);			  
               break;
               case "ad":
			        $("#allmask").css({"opacity":"0.6","width":"100%","height":heightx,"z-index":"99"});
                    $("#popwin").css({"width":offsetWidth,"height":offsetHeight,"left":left1,"top":top1,"z-index":"100","display":""});
                    $htmldata+='<div >'; 
                    $htmldata+='<iframe  scrolling="no" frameborder="0" style="width:100%;height:450px"  src="popwin.php?kind_id='+$loadfunction+'&poptype=1&backdiv='+$backdiv+'&loadprogram='+$loadprogram+'&param1='+$param1+'"></iframe>';
				    $htmldata+='</div>';
                    $("#popwin").html($htmldata);			  
			   break;          
 		   }
  }

function allmask(){
		   var heightx= document.body.scrollHeight;		   
           var offsetWidth=document.body.offsetWidth*0.6;
           var offsetHeight=document.body.offsetHeight*0.6;
           var top1=offsetHeight*0.3;
		   var left1=offsetWidth*0.3;
		   var $htmldata="";
           $("#allmask").css({"opacity":"0.6","width":"100%","height":heightx,"z-index":2});
}

function  closepop(){
  $("#allmask").css({"opacity":"0.6","width":"0","height":"0","z-index":"-9"});
  $("#popwin").css({"width":"0px","height":"0px","left":"0","top":"0","z-index":"-10","display":"none"});
}

function reloaddiv($backdiv,$loadprogram,$param1,$param2){  
	          $.get("services/"+$loadprogram+".php",{"param1":$param1,"param2":$param2},function(data){
	          $("#"+$backdiv).html(data);
	  });
}

//pic class
function picfn($alldel,$filename,$pickind){
       $.get("services/loadpic.php",{"delallpic":$alldel,"filename":$filename,"pickind":$pickind},function(data){ $("#nowpic").html(data); });
}

