function EJEJC_lc(th) { return false; }
var cart_height="";
/*$(document).ready(function(){
	$(window).scroll(function() {
	  $('#EJEJC_window').css('top',0);						  
	});
});*/
function EJEJC_config() {
	EJEJC_WIDTH = 900; 
	//EJEJC_HEIGHT = 500;
	//EJEJC_TOP = 0;
	EJEJC_POSTCALL=true;
	//var my_cart_size=Get_Cookie('EZPRINTS_COOKIE');
	/*if(my_cart_size==""){
		var div_height=600; 
		//div_height=div_height-50;
		EJEJC_HEIGHT=div_height;
	}else{
		var div_height=350;
		div_height=div_height + ((my_cart_size*1+1)*115);
		EJEJC_HEIGHT=div_height;
	}*/
	var win_height=jQuery(window).height();
	win_height=win_height-50;
	EJEJC_HEIGHT=win_height;
	//alert(my_cart_size + ' ' + EJEJC_HEIGHT);
	//alert(div_height + ' ' + cart_height);
}
function EJEJC_shown() 
{
	//scroll(0,0);
	var win_height=jQuery(window).height();
	if(win_height==1500){
		var crt_size=EJEJC_cartsize();
		var cnt_ezprint_prd=0;
		var cart_height_ezprint=0;
		jQuery("td:contains('ProjectId:')").each(function (){
			cnt_ezprint_prd=cnt_ezprint_prd+1;
		});
		var div_height=350;
		div_height=div_height + ((cnt_ezprint_prd*1+1)*115);
		jQuery('#EJEJC_window').css('top',0);
		jQuery('#EJEJC_window').css('background','#ffffff none repeat scroll 100%');
		if(div_height>500){
			jQuery('#EJEJC_iframeContent').css('height',div_height);
			parent.scroll(0,(div_height-500)); 
		}
		//Set_Cookie( 'EZPRINTS_COOKIE', cnt_ezprint_prd, 1, '', '', '' );
	}else{
		/*jQuery('#EJEJC_window').css('top',0);
		win_height=win_height-20;
		jQuery('#EJEJC_iframeContent').css('height',win_height);*/	
		
	}
	var mystr;
	jQuery("td:contains('ProjectId:')").each(function (){
		mystr=jQuery(this).html();
		
		var mypos=mystr.indexOf("(ProjectId:");
		//mypos=mypos-10;
		if(mypos>0){
			var newstr=mystr.substr(0,mypos);
			var imgpos=mystr.indexOf("apps.ezprints.com");
			var strl=mystr.length;
			var imgurl=mystr.substr(imgpos,(strl-imgpos-1));
			imgurl=imgurl.trim();
			imgurl=imgurl.replace(')','');
			imgurl=imgurl.replace(' ','');
			imgurl=imgurl.replace('&nbsp;','');
			imgurl='http://' + imgurl;
		}else{
			var newstr=mystr;
		}
		
		newstr=newstr + '<br/><img src="' + imgurl +'" height="100">';
		jQuery(this).html(newstr);
		
	});
	if(win_height!=1500){
		var win_height=jQuery(window).height();
		var objDiv = document.getElementById("EJEJC_iframeContent");
		var cheight=objDiv.scrollHeight;
		//alert(cheight + ' ' + win_height);
		if(cheight>(win_height-100)){
			objDiv.scrollTop = objDiv.scrollHeight;
			//alert('done');
		}
	}
} 
String.prototype.trim = function() {
a = this.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
};

function Set_Cookie( 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() : "" ) +
         ( ( path ) ? ";path=" + path : "" ) +
         ( ( domain ) ? ";domain=" + domain : "" ) +
         ( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		a_temp_cookie = a_all_cookies[i].split( '=' );
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}


// JavaScript Document
