
/***************************** /home/common/js/common_all.js **********************************************/

function include_dom(script_filename) {

	document.write('<' + 'script');
    document.write(' language="javascript"');
    document.write(' type="text/javascript"');
    document.write(' src="' + script_filename + '">');
    document.write('</' + 'script' + '>');
    
}

	$(document).ready(function (){
		
		$('#siteSearchForm').submit(function (){
			 var url = $(this).attr('action');
			 keyword = $('#siteSearchForm input[type=text]').val();
			 url += 'keyword/'+keyword;
			 document.location.href = url;
			 return false;
	 	});
 	 
	
		switch(page)
		{
			case "contact_us":
			case "return_policy":
			case "link_us":
				$.meta.setType("attr", "validate");
				$("#custInfo").validate();				
				
				// alternate to captcha
				$.get(this_www_root+'ajax.php?cmd=set_form_token',function (data){
					var hdn = '<input type="hidden" name="ts" value="'+data+'">'
					$('#custInfo').append(hdn);
				});			
			break;
            
            case "related_products":
                 jQuery('#related-products').jcarousel({
                    scroll:4,
                    visible:3,
                    initCallback: function (){
                            jQuery('#loading-div').hide();
                            jQuery('.jcarousel-skin-tango').css('visibility','visible');
                            
                        }
                    }); 
            break;
			
			
		}
	});

function append_script_to_header(script_path)
{	
	var script = $('script').filter('[src="'+script_path+'"]');
	if(script.length == 0)
	{
		var str_include = '<' + 'script';
	    str_include += ' language="javascript"';
	    str_include += ' type="text/javascript"';
	    str_include += ' src="' + script_path  + '">';
	    str_include += '</' + 'script' + '>';
			     
	    $('head').append(str_include);
	}
}

function append_script_to_footer(script_path)
{	
	var script = $('script').filter('[src="'+script_path+'"]');	
	if(script.length == 0)
	{
		var str_include = '<' + 'script';
	    str_include += ' language="javascript"';
	    str_include += ' type="text/javascript"';
	    str_include += ' src="' + script_path  + '">';
	    str_include += '</' + 'script' + '>';
			     
	    $('body').append(str_include);
	}
}

function append_style_to_footer(style_path)
{
    var style = $('style').filter('[href="'+style_path+'"]');	
	if(style.length == 0)
	{
	   //<link rel="stylesheet" type="text/css" href="print.css" media="print" />

		var str_include = '<' + 'link';
	    str_include += ' rel="stylesheet"';
	    str_include += ' type="text/css"';
	    str_include += ' href="' + style_path  + '"';
	    str_include += ' />';
			     
	    $('body').append(str_include);
	}
}


var popUpWin=0;

function popUpWindow(URLStr,width,height)
{

  var left = 50;
  var top = 50;

  if(width<1)
  	width = 420;

  if(height<1)
  	height = 495;

  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  //popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  //popUpWin = open(URLStr, 'popUpWin');

}

function roundoff(number,decimal_places)
{
	number = ""+number;
	dot_pos = number.indexOf(".");
	//console.log(dot_pos);
	if(dot_pos==-1){
		// decimal point not found
		// append zeros
		number += "."; 
		for(i=0;i<decimal_places;i++){
			number += "0";
		}
		//console.log(number);
		new_number = number;
		//console.log(new_number);
	}else{
		num_part = dot_pos + decimal_places +1;
		//console.log("indexof: "+num_part);
		new_number = number.substr(0,num_part);
		//console.log(new_number);
		//new_number = (new_number);
	}
	return new_number;
}




function is_valid_email(email){
	return email.match(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ;
}

function is_empty_string(str){	
	
	if(str == ''){
		return true;
	}else if (typeof str=="string" && str.match(/^\s$/i)) {		
		return true;	
	}else{		
		return false;
	}
	
}

function getMousePosX(e)
{
	var posx = 0;
	
	if (!e) var e = window.event;
	if (e.pageX) 	{
		posx = e.pageX;
		
	}
	else if (e.clientX ) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;		
	}
	
	return posx;
}

function getMousePosY(e)
{	
	var posy = 0;
	if (!e) var e = window.event;
	if ( e.pageY) {		
		posy = e.pageY;
	}
	else if (e.clientY) {		
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	
	return posy;

}


function str_replace(search, replace, str)
{
	while(str.indexOf(search) != -1){
        str = str.replace(search,replace);
    }
	return str;
}

/***************************** /home/clary34/public_html/_templates/_js/header.js **********************************************/

$(document).ready(function(){

	$('#bookmark').click(function (event){
		event.preventDefault(); // prevent the anchor tag from sending the user off to the link  
         var url = "http://www.idcard-printers.com";  
         var title = "ID Cards Printers";  
   
         if (window.sidebar) { // Mozilla Firefox Bookmark  
             window.sidebar.addPanel(title, url,"");  
         } else if( window.external ) { // IE Favorite  
             window.external.AddFavorite( url, title);  
         } else if(window.opera) { // Opera 7+  
             return false; // do nothing - the rel="sidebar" should do the trick  
         } else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)  
              alert('Unfortunately, this browser does not support the requested action,'  
              + ' please bookmark this page manually.');  
         }  
	});

});

/***************************** /home/common/js/idcard-wizard/wizard-thickbox-pack.js **********************************************/

/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var wtb_pathToImage = images_web+"loadingAnimation.gif";
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/


eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('$(c).3f(9(){1C(\'a.1a-19, 3o.1a-19, 3z.1a-19\');1B=1t 1N();1B.J=3q});9 1C(1T){$(1T).l(9(){6 t=M.W||M.1r||K;6 a=M.q||M.21;6 g=M.2a||U;1n(t,a,g);M.2S();C U})}9 1n(F,d,18){2T{3(2p c.p.E.2q==="2r"){$("p","11").m({s:"20%",o:"20%"});$("11").m("2o","2N");3(c.1X("1L")===K){$("p").n("<P 5=\'1L\'></P><4 5=\'u\'></4><4 5=\'8\'></4>");$("#u").l(D)}}b{3(c.1X("u")===K){$("p").n("<4 5=\'u\'></4><4 5=\'8\'></4>");$("#u").l(D)}}3(2y()){$("#u").1Z("2X")}b{$("#u").1Z("32")}3(F===K){F=""}$("p").n("<4 5=\'H\'><22 J=\'"+1B.J+"\' /></4>");$(\'#H\').36();6 1f;3(d.L("?")!==-1){1f=d.3u(0,d.L("?"))}b{1f=d}6 1s=/\\.1V$|\\.2h$|\\.2c$|\\.2e$|\\.2b$/;6 N=1f.1x().23(1s);3(N==\'.1V\'||N==\'.2h\'||N==\'.2c\'||N==\'.2e\'||N==\'.2b\'){1I="";1J="";Y="";1P="";1O="";O="";1H="";1o=U;3(18){A=$("a[@2a="+18+"]").34();2l(v=0;((v<A.1m)&&(O===""));v++){6 39=A[v].q.1x().23(1s);3(!(A[v].q==d)){3(1o){1P=A[v].W;1O=A[v].q;O="<1l 5=\'1Y\'>&1k;&1k;<a q=\'#\'>35 &2W;</a></1l>"}b{1I=A[v].W;1J=A[v].q;Y="<1l 5=\'1U\'>&1k;&1k;<a q=\'#\'>&2L; 2P</a></1l>"}}b{1o=1d;1H="1N "+(v+1)+" 2V "+(A.1m)}}}S=1t 1N();S.1c=9(){S.1c=K;6 1M=2B();6 x=1M[0]-25;6 y=1M[1]-25;6 k=S.o;6 j=S.s;3(k>x){j=j*(x/k);k=x;3(j>y){k=k*(y/j);j=y}}b 3(j>y){k=k*(y/j);j=y;3(k>x){j=j*(x/k);k=x}}12=k+30;1h=j+3b;$("#8").n("<a q=\'\' 5=\'2g\' W=\'1z\'><22 5=\'3t\' J=\'"+d+"\' o=\'"+k+"\' s=\'"+j+"\' 21=\'"+F+"\'/></a>"+"<4 5=\'3r\'>"+F+"<4 5=\'3v\'>"+1H+Y+O+"</4></4><4 5=\'3A\'><a q=\'#\' 5=\'X\' W=\'1z\'>1u</a> 1v 1p 1w</4>");$("#X").l(D);3(!(Y==="")){9 13(){3($(c).I("l",13)){$(c).I("l",13)}$("#8").r();$("p").n("<4 5=\'8\'></4>");1n(1I,1J,18);C U}$("#1U").l(13)}3(!(O==="")){9 1F(){$("#8").r();$("p").n("<4 5=\'8\'></4>");1n(1P,1O,18);C U}$("#1Y").l(1F)}c.1e=9(e){3(e==K){B=2K.2H}b{B=e.2G}3(B==27){D()}b 3(B==3e){3(!(O=="")){c.1e="";1F()}}b 3(B==3h){3(!(Y=="")){c.1e="";13()}}};Z();$("#H").r();$("#2g").l(D);$("#8").m({T:"V"})};S.J=d}b{6 24=d.2t(/^[^\\?]+\\??/,\'\');6 G=2F(24);12=(G[\'o\']*1)||3k;1h=(G[\'s\']*1)+2O||3n;Q=12;R=1h-3i;3(d.L(\'2I\')!=-1){1D=d.1Q(\'3d\');$("#14").r();3(G[\'1q\']!="1d"){$("#8").n("<4 5=\'1S\'><4 5=\'1y\'>"+F+"</4><4 5=\'1W\'><a q=\'#\' 5=\'X\' W=\'1z\'>1u</a> 1v 1p 1w</4></4><P 26=\'0\' 28=\'0\' J=\'"+1D[0]+"\' 5=\'14\' 1r=\'14"+1b.2f(1b.1A()*2d)+"\' 1c=\'1G()\' E=\'o:"+(Q+29)+"f;s:"+(R+17)+"f;\' > </P>")}b{$("#u").I();$("#8").n("<P 26=\'0\' 28=\'0\' J=\'"+1D[0]+"\' 5=\'14\' 1r=\'14"+1b.2f(1b.1A()*2d)+"\' 1c=\'1G()\' E=\'o:"+(Q+29)+"f;s:"+(R+17)+"f;\'> </P>")}}b{3($("#8").m("T")!="V"){3(G[\'1q\']!="1d"){$("#8").n("<4 5=\'1S\'><4 5=\'1y\'>"+F+"</4><4 5=\'1W\'><a q=\'#\' 5=\'X\'>1u</a> 1v 1p 1w</4></4><4 5=\'z\' E=\'o:"+Q+"f;s:"+R+"f\'></4>")}b{$("#u").I();$("#8").n("<4 5=\'z\' 3s=\'31\' E=\'o:"+Q+"f;s:"+R+"f;\'></4>")}}b{$("#z")[0].E.o=Q+"f";$("#z")[0].E.s=R+"f";$("#z")[0].3B=0;$("#1y").11(F)}}$("#X").l(D);3(d.L(\'2Z\')!=-1){$("#z").n($(\'#\'+G[\'2J\']).2i());$("#8").2E(9(){$(\'#\'+G[\'2J\']).n($("#z").2i())});Z();$("#H").r();$("#8").m({T:"V"})}b 3(d.L(\'2I\')!=-1){Z();3($.1E.33){$("#H").r();$("#8").m({T:"V"})}}b{$("#z").37(d+="&1A="+(1t 3a().2M()),9(){Z();$("#H").r();1C("#z a.1a-19");$("#8").m({T:"V"})})}}3(!G[\'1q\']){c.2n=9(e){3(e==K){B=2K.2H}b{B=e.2G}3(B==27){D()}}}}3g(e){}}9 1G(){$("#H").r();$("#8").m({T:"V"})}9 D(){$("#3c").I("l");$("#X").I("l");$("#8").3j("3l",9(){$(\'#8,#u,#1L\').3m("2E").I().r()});$("#H").r();3(2p c.p.E.2q=="2r"){$("p","11").m({s:"2s",o:"2s"});$("11").m("2o","")}c.1e="";c.2n="";C U}9 Z(){$("#8").m({3p:\'-\'+2k((12/2),10)+\'f\',o:12+\'f\'});3(!(2j.1E.3x&&2j.1E.3y<7)){$("#8").m({3w:\'-\'+2k((1h/2),10)+\'f\'})}}9 2F(1K){6 1i={};3(!1K){C 1i}6 1R=1K.1Q(/[;&]/);2l(6 i=0;i<1R.1m;i++){6 15=1R[i].1Q(\'=\');3(!15||15.1m!=2){2Q}6 2u=2m(15[0]);6 1g=2m(15[1]);1g=1g.2t(/\\+/g,\' \');1i[2u]=1g}C 1i}9 2B(){6 16=c.38;6 w=2A.2C||2z.2C||(16&&16.2D)||c.p.2D;6 h=2A.2v||2z.2v||(16&&16.2w)||c.p.2w;2x=[w,h];C 2x}9 2y(){6 1j=2Y.1j.1x();3(1j.L(\'2U\')!=-1&&1j.L(\'2R\')!=-1){C 1d}}',62,224,'|||if|div|id|var||TB_window|function||else|document|url||px||||imageHeight|imageWidth|click|css|append|width|body|href|remove|height||TB_overlay|TB_Counter||||TB_ajaxContent|TB_TempArray|keycode|return|wtb_remove|style|caption|params|TB_load|unbind|src|null|indexOf|this|urlType|TB_NextHTML|iframe|ajaxContentW|ajaxContentH|imgPreloader|display|false|block|title|TB_closeWindowButton|TB_PrevHTML|wtb_position||html|TB_WIDTH|goPrev|TB_iframeContent|KeyVal|de||imageGroup|thickbox|wizard|Math|onload|true|onkeydown|baseURL|val|TB_HEIGHT|Params|userAgent|nbsp|span|length|wtb_show|TB_FoundURL|Esc|modal|name|urlString|new|close|or|Key|toLowerCase|TB_ajaxWindowTitle|Close|random|imgLoader|wtb_init|urlNoQuery|browser|goNext|wtb_showIframe|TB_imageCount|TB_PrevCaption|TB_PrevURL|query|TB_HideSelect|pagesize|Image|TB_NextURL|TB_NextCaption|split|Pairs|TB_title|domChunk|TB_prev|jpg|TB_closeAjaxWindow|getElementById|TB_next|addClass|100|alt|img|match|queryString|150|frameborder||hspace||rel|bmp|png|1000|gif|round|TB_ImageOff|jpeg|children|jQuery|parseInt|for|unescape|onkeyup|overflow|typeof|maxHeight|undefined|auto|replace|key|innerHeight|clientHeight|arrayPageSize|wtb_detectMacXFF|self|window|wtb_getPageSize|innerWidth|clientWidth|unload|wtb_parseQuery|which|keyCode|TB_iframe|inlineId|event|lt|getTime|hidden|40|Prev|continue|firefox|blur|try|mac|of|gt|TB_overlayMacFFBGHack|navigator|TB_inline||TB_modal|TB_overlayBG|safari|get|Next|show|load|documentElement|urlTypeTemp|Date|60|TB_imageOff|TB_|190|ready|catch|188|45|fadeOut|630|fast|trigger|440|area|marginLeft|wtb_pathToImage|TB_caption|class|TB_Image|substr|TB_secondLine|marginTop|msie|version|input|TB_closeWindow|scrollTop'.split('|'),0,{}))


/***************************** /home/common/js/idcard-wizard/idcard_wizard.js **********************************************/

function processPrevious(cur_tab){
	
	prev_tab = cur_tab-1;
	disabled = $('#disabled-list').html();
	arr_tmp = disabled.split(',');	
	
	
	if(arr_tmp.length > 1){			
	
		while(array_indexOf(arr_tmp,prev_tab) !== false ){
			prev_tab -= 1;
			
		}
	}
	
	$("#wizard_tabs ul").tabs("enable", prev_tab);
	$("#wizard_tabs ul").tabs("select", prev_tab);
	$("#wizard_tabs ul").tabs("disable", cur_tab);
		
	
}

function processNext(ctrl,step,is_multiple)
{
	
	$('div.processing').fadeIn('slow');
	var criteria_value = "";
	if(is_multiple){
		$(ctrl).filter('input:checked').each(function (){
			criteria_value += $(this).val() + ",";
		});	
			
		if(criteria_value != ""){
			criteria_value = criteria_value.substring(0,criteria_value.length-1);
		}
		
	}else{
		criteria_value = $(ctrl).filter('input:checked').val();
	}
	
	if(!criteria_value){
		criteria_value = "";
	}
	
	
	$.post(this_www_root+"index.php", {cmd:"product_selection_wizard",step:step,criteria_value:criteria_value}, function (data){
		$('#TB_ajaxContent').html("");
		$('#TB_ajaxContent').html(data);
		$('div.processing').fadeOut('slow');
	});
}


function close_wizard()
{
	$.get(this_www_root+"index.php",{cmd:"reset_wizard"});
	wtb_remove();
}

function restart_wizard()
{
	$.get(this_www_root+"index.php",{cmd:"product_selection_wizard",restart:"true"},function (data){
		$('#TB_ajaxContent').html("");
		$('#TB_ajaxContent').html(data);
	});	
}




function array_indexOf(arr,val)
{
	//console.log(arr);
	//console.log(val)
	for(var i=0; i<arr.length;i++){
		if(arr[i] == val){
			return i;
		}
	}
	return false;
}



function showProducts(application,volume,capability,color,security){
	
	url = $('#products_list_link').attr('href');
	
	if(url.charAt(url.length-1) != "/"){
		url += "/";
	}
	
	if(application !=""){
		url += 'Applications/'+application.replace(/ /g,'_')+'/';
	}
	
	if(volume !=""){
		url += 'Printing_Volume/'+volume.replace(/ /g,'_')+'/'; 
	}
	
	if(capability !=""){
		url += 'Capabilities/'+capability.replace(/ /g,'_')+'/'; 
	}
	
	if(color !=""){
		url += 'Color_Type/'+color.replace(/ /g,'_')+'/'; 
	}
	
	if(security !=""){
		url += 'Security/'+security.replace(/ /g,'_')+'/'; 
	}
	
	document.location.href = url;
	
}

/***************************** /home/clary34/public_html/_templates/_js/site.js **********************************************/

$(document).ready(function(){

		
	switch(page)
	{

		
		case "contact_us":
		case "return_policy":
		case "static":
		case "search":
		case "product":
		case "product_list":
			adjust_panel_height();
			//$('#panel-left').corner("round tr");
		break;
		
		
		case "help":
			$('.help-content-link').click(function (){
				if ($(this).siblings('.slide-up').css('display') == 'block'){
					$(this).siblings('.slide-up').slideUp();
				}else{
					$(this).siblings('.slide-up').slideDown();
				}
			});
			
			adjust_panel_height();
			//$('#panel-left').corner("round tr");
		break
			
		
		case "comparison":
			$('#comparison').flexigrid({height:'auto',striped:false});
			adjust_panel_height();
			//$('#panel-left').corner("round tr");
		break;	
	}
	

});

function adjust_panel_height(){
	/*new_height = $("#panel-right").height();			
	prev_height = $("#panel-left").height();
	if(prev_height < new_height){
		$("#panel-left").css('height',new_height+'px');
	}	*/
}

