// ================================= //
// ================================= //
// include/validationscript/jlist.js //
// ================================= //
// ================================= //
function chkupdate()
{
 document.form1._act.value='Update';
 document.form1.submit();
 return true;
}
function ALLsearch()
{
	document.form1.letter.value ='';
	document.form1.submit();
	return true;
}
function getCheckCount()
{	
	var x=0;
	for(i=0;i < document.form1.elements.length;i++)
	{	if (document.form1.elements[i].id == 'iId' && document.form1.elements[i].checked == true) 
			{x++;}
	}
	if(x ==0)
	{
	alert('Please select a record to enable/disable');
	return false;
	}
	else
	{
	document.form1._act.value='changestatus';
	document.form1.submit();
	return true;
	}
}
function getCheckCountk()
{	
	var x=0;
	for(i=0;i < document.form1.elements.length;i++)
	{	if (document.form1.elements[i].id == 'iId' && document.form1.elements[i].checked == true) 
			{x++;}
	}
	if(x ==0)
	{
		alert('Please select a record to approve / reject');
		return false;
	}
	else
	{
		document.form1.action.value='changestatus';
		document.form1.submit();
		return true;
	}
}
function categorydelete(catid,prodno)
{
	var ans;
	if(prodno>0)
	{
		if (prodno>1) 
		{ 
			productstr="products"; 
		}
		else 
		{ 
			productstr="product"; 
		}
	alert("You are about to delete "+prodno+" "+productstr+" in this category, click ok to proceed ?");
	//return false;	
	}
	else
	{
		ans =  confirm("Do you really want to delete this record ?");
		if (ans)
		{ 
		 document.form1.action.value='Delete';
		 document.form1.DeleteId.value=catid;
		 document.form1.submit();
		 return true;
		}
	}
}
function openWin(id, has_rights)
{	
	if(has_rights==undefined || has_rights=='1')
	{
	 var ans;
	 ans =  confirm("Do you really want to delete this record ?");
		if(ans)
		{ 
		 document.form1.method = "POST";
		 document.form1._act.value='Delete';
		 document.form1.DeleteId.value=id;
		 document.form1.submit();
		 return true;
		}
	}
	else
	{
		alert('You are not authorised to perform this action');
	}
}
function openDeleteWin(id, has_rights)
{	
	if(has_rights==undefined || has_rights=='1')
	{
	 var ans;
	 ans =  confirm("Do you really want to delete this record ?");
		if(ans)
		{
		 document.form1.method = "POST";
		 document.form1._act.value='Delete';
		 document.form1.DeleteId.value=id;
		 document.form1.submit();
		 return true;
		}
	}
	else
	{
		alert('You are not authorised to perform this action');
	}
}
function openDisableWin(id, has_rights,disabled)
{	
	var dis_text;
	if(disabled == 0)
	{
		dis_text = "disable";
	}else
	{
		dis_text = "enable";
	}
	if(has_rights==undefined || has_rights=='1')
	{
	 var ans;
	 ans =  confirm("Do you really want to "+dis_text+" this record ?");
		if(ans)
		{
		 document.form1.method = "POST";
		 document.form1._act.value=dis_text;
		 document.form1.DeleteId.value=id;
		 document.form1.submit();
		 return true;
		}
	}
	else
	{
		alert('You are not authorised to perform this action');
	}
}
function deleteCategoryPopup(cat_type, id, has_rights)
{
	if(has_rights==undefined || has_rights=='1')
	{
		if(cat_type=='PARENTCAT')
		{
			var msg = "Deletion of category will result in deletion of all the subcategories and products under this category.\n\nClick ok to proceed ?";
		}
		else if(cat_type=='SUBCAT')
		{
			var msg = "Deletion of category will result in deletion of all the products under this category.\n\nClick ok to proceed ?";
		}	
	
		var ans;
		ans =  confirm(msg);
		if(ans)
		{ 
			document.form1.method="POST";
			document.form1._act.value='Delete';
			document.form1.DeleteId.value=id;
			document.form1.submit();
			return true;
		}
	}
	else
	{
		alert('You are not authorised to perform this action');
	}
}
function openWinweekly(id)
{
	var ans;
	ans =  confirm("Do you really want to make weekly poll to this record ?");
	if (ans)
	{ 
		document.form1.action.value='Weekly';
		document.form1.DeleteId.value=id;
		document.form1.submit();
		return true;
	}
}
function deletefrontrecs(id)
{
	var ans;
	// ans =  confirm("Do you really want to delete this record ?");
	//if (ans)
	//{ 
	document.form1.action1.value='Delete';
	document.form1.DeleteId.value=id;
	document.form1.submit();
	return true;
	//}
}
function deleterecs(id)
{
	var ans;
	ans =  confirm("Do you really want to delete this record ?");
	if (ans)
	{ 
		document.form1.action1.value='Delete';
		document.form1.DeleteId.value=id;
		document.form1.submit();
		return true;
	}
}
function paging(page)
{
	form1.PageNo.value = page;	 
	//document.form1.search.value = '<?=$search;?>';
	form1.submit();
}
// =================================== //
// =================================== //
// include/validationscript/topmenu.js //
// =================================== //
// =================================== //
var anylinkmenu=
{
	menusmap: {},
	effects: {delayhide: 200, shadow:{enabled:true, opacity:0.3, depth: [5, 5]}, fade:{enabled:false, duration:500}}, //customize menu effects
	dimensions: {},

	getoffset:function(what, offsettype)
	{
		return (what.offsetParent)? what[offsettype]+this.getoffset(what.offsetParent, offsettype) : what[offsettype]
	},

	getoffsetof:function(el)
	{
		el._offsets={left:this.getoffset(el, "offsetLeft"), top:this.getoffset(el, "offsetTop"), h: el.offsetHeight}
	},

	getdimensions:function(menu)
	{
		this.dimensions=
		{
			anchorw:menu.anchorobj.offsetWidth, anchorh:menu.anchorobj.offsetHeight,
			docwidth:(window.innerWidth ||this.standardbody.clientWidth)-20,
			docheight:(window.innerHeight ||this.standardbody.clientHeight)-15,
			docscrollx:window.pageXOffset || this.standardbody.scrollLeft,
			docscrolly:window.pageYOffset || this.standardbody.scrollTop
		}
		if (!this.dimensions.dropmenuw)
		{
			this.dimensions.dropmenuw=menu.dropmenu.offsetWidth
			this.dimensions.dropmenuh=menu.dropmenu.offsetHeight
		}
	},

	isContained:function(m, e)
	{
		var e=window.event || e
		var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
		while (c && c!=m)
		try{c=c.parentNode} catch(e){c=m}
		
		if (c==m)
			return true
		else
			return false
	},

	setopacity:function(el, value)
	{
		el.style.opacity=value
		if (typeof el.style.opacity!="string")
		{ //if it's not a string (ie: number instead), it means property not supported
			el.style.MozOpacity=value
			if (el.filters)
			{
				el.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+ value*100 +")"
			}
		}
	},

	showmenu:function(menuid)
	{
		var menu=anylinkmenu.menusmap[menuid]
		clearTimeout(menu.hidetimer)
		this.getoffsetof(menu.anchorobj)
		this.getdimensions(menu)
		var posx=menu.anchorobj._offsets.left + (menu.orientation=="lr"? this.dimensions.anchorw : 0) //base x pos
		var posy=menu.anchorobj._offsets.top+this.dimensions.anchorh - (menu.orientation=="lr"? this.dimensions.anchorh : 0)//base y pos
		
		if (posx+this.dimensions.dropmenuw+this.effects.shadow.depth[0]>this.dimensions.docscrollx+this.dimensions.docwidth)
		{ //drop left instead?
			posx=posx-this.dimensions.dropmenuw + (menu.orientation=="lr"? -this.dimensions.anchorw : this.dimensions.anchorw)
		}
		if (posy+this.dimensions.dropmenuh>this.dimensions.docscrolly+this.dimensions.docheight)
		{  //drop up instead?
			posy=Math.max(posy-this.dimensions.dropmenuh - (menu.orientation=="lr"? -this.dimensions.anchorh : this.dimensions.anchorh), this.dimensions.docscrolly) //position above anchor or window's top edge
		}
		if (this.effects.fade.enabled)
		{
			this.setopacity(menu.dropmenu, 0) //set opacity to 0 so menu appears hidden initially
			if (this.effects.shadow.enabled)
				this.setopacity(menu.shadow, 0) //set opacity to 0 so shadow appears hidden initially
		}
		menu.dropmenu.setcss({left:posx+'px', top:posy+'px', visibility:'visible'})
		if (this.effects.shadow.enabled)
		{
			//menu.shadow.setcss({width: menu.dropmenu.offsetWidth+"px", height:menu.dropmenu.offsetHeight+"px"})
			menu.shadow.setcss({left:posx+anylinkmenu.effects.shadow.depth[0]+'px', top:posy+anylinkmenu.effects.shadow.depth[1]+'px', visibility:'visible'})
		}
		if (this.effects.fade.enabled)
		{
			clearInterval(menu.animatetimer)
			menu.curanimatedegree=0
			menu.starttime=new Date().getTime() //get time just before animation is run
			menu.animatetimer=setInterval(function(){anylinkmenu.revealmenu(menuid)}, 20)
		}
	},

	revealmenu:function(menuid)
	{
		var menu=anylinkmenu.menusmap[menuid]
		var elapsed=new Date().getTime()-menu.starttime //get time animation has run
		if (elapsed<this.effects.fade.duration)
		{
			this.setopacity(menu.dropmenu, menu.curanimatedegree)
			if (this.effects.shadow.enabled)
				this.setopacity(menu.shadow, menu.curanimatedegree*this.effects.shadow.opacity)
		}
		else
		{
			clearInterval(menu.animatetimer)
			this.setopacity(menu.dropmenu, 1)
			menu.dropmenu.style.filter=""
		}
		menu.curanimatedegree=(1-Math.cos((elapsed/this.effects.fade.duration)*Math.PI)) / 2
	},

	setcss:function(param)
	{
		for (prop in param)
		{
			this.style[prop]=param[prop]
		}
	},

	hidemenu:function(menuid)
	{
		var menu=anylinkmenu.menusmap[menuid]
		clearInterval(menu.animatetimer)
		menu.dropmenu.setcss({visibility:'hidden', left:0, top:0})
		menu.shadow.setcss({visibility:'hidden', left:0, top:0})
	},

	getElementsByClass:function(targetclass)
	{
		if (document.querySelectorAll)
			return document.querySelectorAll("."+targetclass)
		else{
			var classnameRE=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "i") //regular expression to screen for classname
			var pieces=[]
			var alltags=document.all? document.all : document.getElementsByTagName("*")
			for (var i=0; i<alltags.length; i++){
				if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
					pieces[pieces.length]=alltags[i]
			}
			return pieces
		}
	},

	addDiv:function(divid, divclass, inlinestyle)
	{
		var el = document.createElement("div")
		
		if (divid)
		{
			el.id=divid
		}
		el.className = divclass
		if (inlinestyle!="" && typeof el.style.cssText=="string")
		{
			el.style.cssText=inlinestyle
		}
		else if (inlinestyle!="")
		{
			el.setAttribute('style', inlinestyle)
		}
		document.body.appendChild(el)
		return el
	},

	getmenuHTML:function(menuobj)
	{
		var menucontent=[]
		var frag=""
		for (var i=0; i<menuobj.items.length; i++)
		{
			frag+='<li><a href="' + menuobj.items[i][1] + '" target="' + menuobj.linktarget + '">' + menuobj.items[i][0] + '</a></li>\n'
			if (menuobj.items[i][2]=="efc" || i==menuobj.items.length-1)
			{
				menucontent.push(frag)
				frag=""
			}
		}
		if (typeof menuobj.cols=="undefined")
			return '<ul>\n' + menucontent.join('') + '\n</ul>'
		else
		{
			frag=""
			for (var i=0; i<menucontent.length; i++){
				frag+='<div class="' + menuobj.cols.divclass + '" style="' + menuobj.cols.inlinestyle + '">\n<ul>\n' + menucontent[i] + '</ul>\n</div>\n'
			}
			return frag
		}
	},

	addEvent:function(targetarr, functionref, tasktype)
	{
		if (targetarr.length>0)
		{
			var target=targetarr.shift()
			if (target.addEventListener)
				target.addEventListener(tasktype, functionref, false)
			else if (target.attachEvent)
				target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)})
			this.addEvent(targetarr, functionref, tasktype)
		}
	},

	setupmenu:function(targetclass, anchorobj, pos)
	{
		this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		
		var relattr = anchorobj.getAttribute("rel")
		dropmenuid = relattr.replace(/\[(\w+)\]/, '')
		var dropmenuvar = window[dropmenuid]
		
		var dropmenu = this.addDiv(null, dropmenuvar.divclass, dropmenuvar.inlinestyle) //create and add main sub menu DIV
		
		dropmenu.innerHTML=this.getmenuHTML(dropmenuvar)
		
		var menu=this.menusmap[targetclass+pos]=
		{
			id: targetclass+pos,
			anchorobj: anchorobj,	
			dropmenu: dropmenu,
			revealtype: (relattr.length!=dropmenuid.length && RegExp.$1=="click")? "click" : "mouseover",
			orientation: anchorobj.getAttribute("rev")=="lr"? "lr" : "ud",
			shadow: this.addDiv(null, "anylinkshadow", null) //create and add corresponding shadow
		}
		


		menu.anchorobj._internalID=targetclass+pos
		menu.anchorobj._isanchor=true
		menu.dropmenu._internalID=targetclass+pos
		menu.shadow._internalID=targetclass+pos
		menu.dropmenu.setcss=this.setcss
		menu.shadow.setcss=this.setcss
		menu.shadow.setcss({width: menu.dropmenu.offsetWidth+"px", height:menu.dropmenu.offsetHeight+"px"})
		
		this.setopacity(menu.shadow, this.effects.shadow.opacity)
		
		
		this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e)
		{ //MOUSEOVER event for anchor, dropmenu, shadow
			var menu=anylinkmenu.menusmap[this._internalID]
			if (this._isanchor && menu.revealtype=="mouseover" && !anylinkmenu.isContained(this, e))
			{ //event for anchor
				anylinkmenu.showmenu(menu.id)
			}
			else if (typeof this._isanchor=="undefined")
			{ //event for drop down menu and shadow
				clearTimeout(menu.hidetimer)
			}
		}, "mouseover")
		
		this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e)
		{ //MOUSEOUT event for anchor, dropmenu, shadow
			if (!anylinkmenu.isContained(this, e)){
				var menu=anylinkmenu.menusmap[this._internalID]
				menu.hidetimer=setTimeout(function(){anylinkmenu.hidemenu(menu.id)}, anylinkmenu.effects.delayhide)
			}
		}, "mouseout")
		
		this.addEvent([menu.anchorobj, menu.dropmenu], function(e)
		{ //CLICK event for anchor, dropmenu
			var menu=anylinkmenu.menusmap[this._internalID]
			if ( this._isanchor && menu.revealtype=="click"){
				if (menu.dropmenu.style.visibility=="visible")
					anylinkmenu.hidemenu(menu.id)
				else
					anylinkmenu.showmenu(menu.id)
				if (e.preventDefault)
					e.preventDefault()
				return false
			}
			else
				menu.hidetimer=setTimeout(function(){anylinkmenu.hidemenu(menu.id)}, anylinkmenu.effects.delayhide)
		}, "click")
	},

	init:function(targetclass)
	{
		var anchors=this.getElementsByClass(targetclass)
		for (var i=0; i<anchors.length; i++)
		{
			this.setupmenu(targetclass, anchors[i], i)
		}
	}
}

// ============================================ //
// ============================================ //
// include/validationscript/topmenu_contents.js //
// ============================================ //
// ============================================ //
//First menu variable. Make sure "anylinkmenu1" is a unique name!
var anylinkmenu1=
{
	divclass:'anylinkmenu', inlinestyle:'', linktarget:''
}
anylinkmenu1.items=
[
 	['Home'					, tmp_rootpath + 'genre'],
	['Art and Photography'	, tmp_rootpath + 'genre/The-Arts'],
	['Astrology and Occult'	, tmp_rootpath + 'genre/Astrology'],
	['Biography'			, tmp_rootpath + 'genre/Biography-True-Stories'],
	['Business'				, tmp_rootpath + 'genre/Economics-Finance-Business-Management'],
	['Classics and Poetry'	, tmp_rootpath + 'genre/Poetry'],
	['Computing'			, tmp_rootpath + 'genre/Computing-Information-Technology'],
	['Crafts'				, tmp_rootpath + 'genre/Handicrafts-Decorative-Arts-Crafts'],
	['Crime'				, tmp_rootpath + 'genre/True-Crime'],
	['Hobbies'				, tmp_rootpath + 'genre/Hobbies'],
	['Education'			, tmp_rootpath + 'genre/Education'],
	['Fiction'				, tmp_rootpath + 'genre/Fiction-Related-Items'],
	['Fashion'				, tmp_rootpath + 'genre/Fashion-Society'],
	['Food and Drink'		, tmp_rootpath + 'genre/Cookery-Food-Drink-Etc'],
	['Health'				, tmp_rootpath + 'genre/Health-Economics'],
	['History'				, tmp_rootpath + 'genre/History'],
	['Home and Garden'		, tmp_rootpath + 'genre/Home-House-Maintenance'],
	['Humour'				, tmp_rootpath + 'genre/Humour'],
	['Law'					, tmp_rootpath + 'genre/Law'],
	['Music and Film'		, tmp_rootpath + 'genre/Music'],
	['Medical'				, tmp_rootpath + 'genre/Medicine'],
	['Personal Development'	, tmp_rootpath + 'genre/Health-Personal-Development'],
	['Religious'			, tmp_rootpath + 'genre/Religion-General'],
	['Romance'				, tmp_rootpath + 'genre/Romance'],
	['Sci-Fi and Fantasy'	, tmp_rootpath + 'genre/Fantasy'],
	['Science and Nature'	, tmp_rootpath + 'genre/Science-General-Issues'],
	['Society and Politics'	, tmp_rootpath + 'genre/Society-Social-Sciences'],
	['Sports and Games'		, tmp_rootpath + 'genre/Sports-Psychology'],
	['Travel and Transport'	, tmp_rootpath + 'genre/Travel-Holiday']
	
	//no comma following last entry!
]

// Second menu variable. Make sure "anylinkmenu2" is a unique name!
var anylinkmenu2=
{
	divclass:'anylinkmenu', inlinestyle:'', linktarget:''
}
anylinkmenu2.items=
[
	['Home', tmp_rootpath + 'more/top_sellers']
	//no comma following last entry!
]

//First menu variable. Make sure "anylinkmenu3" is a unique name!
var anylinkmenu3=
{
	divclass:'anylinkmenu', inlinestyle:'', linktarget:''
}
anylinkmenu3.items=
[
 	['Home', '#']
	//no comma following last entry!
]

//First menu variable. Make sure "anylinkmenu4" is a unique name!
var anylinkmenu4=
{
	divclass:'anylinkmenu', inlinestyle:'', linktarget:''
}
anylinkmenu4.items=
[
 	['Home', '#']
	//no comma following last entry!
]

// ====================================== //
// ====================================== //
// include/validationscript/tabcontent.js //
// ====================================== //
// ====================================== //

//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: Nov 8th, 06

var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs=new Object()

function expandcontent(linkobj){
var ulid=linkobj.parentNode.parentNode.id //id of UL element
//alert(ulid);
var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
for (var i=0; i<ullist.length; i++){
ullist[i].className=""  //deselect all tabs
if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
}
linkobj.parentNode.className="selected"  //highlight currently clicked on tab
document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
if (thetab.getAttribute("rel"))
expandcontent(thetab)
}

function savetabcontentids(ulid, relattribute){// save ids of tab content divs
if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
tabcontentIDs[ulid]=new Array()
tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
}

function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, selectedtabid)
}

function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content
var ullist=document.getElementById(ulid).getElementsByTagName("li")
for (var i=0; i<ullist.length; i++){
if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){
return ullist[i].getElementsByTagName("a")[0]
break
}
}
}

function initializetabcontent(){	
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off
setCookie(arguments[i], "")
var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
if (ulistlink.getAttribute("rel")){
savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
//alert(ulistlink);
ulistlink.onclick=function(){
expandcontent(this)
return false
}
if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default
expandcontent(ulistlink) //auto load currenly selected tab content
}
} //end inner for loop
if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value
var culistlink=getullistlinkbyId(arguments[i], clickedontab)
if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value
expandcontent(culistlink) //auto load currenly selected tab content
else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
}
} //end outer for loop
}



function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}


/*function funDoActive(ActiveObj){
	var activeDiv = document.getElementById('activeDivName').value;
	
	if(activeDiv.length > 0){
		document.getElementById(activeDiv).className='inactive';
		document.getElementById(activeDiv+"1").style.display='none';
		document.getElementById(activeDiv+"2").style.display='';
		document.getElementById(activeDiv+"cont").style.display='none';
		document.getElementById(activeDiv+"imgl").src='images/curve_inact_l.gif';
		document.getElementById(activeDiv+"imgr").src='images/curve_inact_r.gif';
	}
	document.getElementById('activeDivName').value=ActiveObj;
	document.getElementById(ActiveObj).className='active';
	document.getElementById(ActiveObj+"1").style.display='';
	document.getElementById(ActiveObj+"2").style.display='none';
	document.getElementById(ActiveObj+"cont").style.display='';
	document.getElementById(ActiveObj+"imgl").src='images/curve_act_l.gif';
	document.getElementById(ActiveObj+"imgr").src='images/curve_act_r.gif';
}*/

function funDoActive(ActiveObj)
{
	var activeDiv = document.getElementById('activeDivName').value;
	if(activeDiv.length > 0)
	{
		document.getElementById(activeDiv).className='inactive';
		document.getElementById(activeDiv+"1").style.display='none';
		document.getElementById(activeDiv+"2").style.display='';
		document.getElementById(activeDiv+"cont").style.display='none';
		document.getElementById(activeDiv+"imgl").src=tmp_rootpath+'images/curve_inact_l.gif';
		document.getElementById(activeDiv+"imgr").src=tmp_rootpath+'images/curve_inact_r.gif';
	}
	document.getElementById('activeDivName').value=ActiveObj;
	document.getElementById(ActiveObj).className='active';
	document.getElementById(ActiveObj+"1").style.display='';
	document.getElementById(ActiveObj+"2").style.display='none';
	document.getElementById(ActiveObj+"cont").style.display='';
	document.getElementById(ActiveObj+"imgl").src=tmp_rootpath+'images/curve_act_l.gif';
	document.getElementById(ActiveObj+"imgr").src=tmp_rootpath+'images/curve_act_r.gif';
}

// ====================================== //
// ====================================== //
// include/validationscript/popup.js //
// ====================================== //
// ====================================== //

function openwin(url, win_width, win_height)
{
	if(win_width == undefined || win_width == null)
		win_width=780;
	if(win_height == undefined || win_height == null)
		win_height=550;
		
	var win_param = "width=" + win_width + ",height=" + win_height + ",scrollbars=1";	
	var win_obj=window.open(url,"jj",win_param);
	windowX = (window.screen.width-win_width)/2;
	windowY = (window.screen.height-win_height)/2;
	
	win_obj.moveTo(windowX,windowY);
}

function openimagewin(url)
{
	window.child=window.open(url,"imagewin","width=500,height=300,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no");
	
	try
	{		
		var imageWidth = window.child.document.images(0).width;
		var imageHeight = window.child.document.images(0).height;
		window.child.resizeTo(imageWidth+100, imageHeight+100);
		windowX = (window.screen.width-imageWidth)/2;
		windowY = (window.screen.height-imageHeight)/2;
		window.child.moveTo(windowX,windowY);
	}
	catch (e)
	{
		//do nothing
	}
}

function openeditor(fname,sessvar) 
{
	url = tmp_rootpath+"administration/editor.php?fname="+fname+"&sessvar="+sessvar;
	vWinCal = window.open(url,"Editor","left=20, top=20, width=700,height=500,scrollbars=0");
	windowX = (window.screen.width-700)/2;
	windowY = (window.screen.height-500)/2;
	vWinCal.moveTo(windowX,windowY);
	vWinCal.opener = self;
}

// ====================================== //
// ====================================== //
// include/validationscript/common.js //
// ====================================== //
// ====================================== //

/* Top Common Menu script */
var arr_url = tmp_rootpath.split('/');
// Temporarily commented due to 'navbar' is not available
if(arr_url[4] != 'registration')
{
	sfHover = function() 
	{ 
		var sfEls = document.getElementById("navbar").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) 
		{
			sfEls[i].onmouseover=function() {var list = this.getElementsByTagName("UL")[0];if(list){list.style.left  = "auto";}};
			sfEls[i].onmouseout=function() {var list = this.getElementsByTagName("UL")[0];if(list){list.style.left  = "-999em";}}
		}
	};
	if (window.attachEvent){window.attachEvent("onload", sfHover);}if (window.addEventListener){window.addEventListener("load", sfHover, false);};
}

function RedirectPage(product_link)
{
	if( product_link )
	{
		window.location = product_link;
	}
}

function openWin1(url)
{
	var j=window.open(url,"jj","left=20, top=20, width=550,height=600,scrollbars=1") 
}

function openWin2(url)
{
	var j=window.open(url,"jj","left=20, top=20, width=700,height=570,scrollbars=1") 
}

function openWin3(url)
{
	var j=window.open(url,"jj","left=20, top=20, width=500,height=300,scrollbars=1") 
}

function openWinlarge(url)
{
	var j=window.open(url,"jj","left=20, top=20, width=500,height=410,scrollbars=1") 
}



function openWin4(url)
{
var j=window.open(url,"jj","left=20, top=20, width=400,height=180,scrollbars=1") 
}
function openWin5(url)
{
var j=window.open(url,"jj","left=20, top=20, width=550,height=500,scrollbars=1") 
}

function openprint(url)
{
var j=window.open(url,"jj","left=20, top=20, width=900,height=900,scrollbars=1") 
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function changebg(elementId)
{
	fmobj	=	document.form1;
	re = /bigform12/gi;
	for (var i=0;i<fmobj.elements.length;i++) {
		var e = fmobj.elements[i];	
		if(e!=elementId)
			e.className = e.className.replace(re, '');
		else
			elementId.className += elementId.className+' bigform12';	
	}
	
	if(elementId.value.length>0)
		elementId.className += elementId.className+' bigform12';
}
function visibleMoreCat_presc(){
	if(document.getElementById("set_more_link").value == 0){
		document.getElementById("set_more_link").value = 1;
		document.getElementById("more_cat").style.display = "";
		document.getElementById("pres_dont").style.display ="none"
		
	}else{
		document.getElementById("set_more_link").value = 0;		
		document.getElementById("pres_dont").style.display =""
		document.getElementById("more_cat").style.display = "none";
	}
}
function visibleMoreCat(){
	
	if(document.getElementById("set_more_link").value == 0){
		document.getElementById("set_more_link").value = 1;
		document.getElementById("more_cat").style.display = "";
		document.getElementById("brandList").style.display = "none";
		document.getElementById("viewBrandLink").style.display = "none";
		document.getElementById("viewAllBrandLink").style.display = "";
		document.getElementById("backId").style.display = "";
		
		
		if(document.getElementById("pres_dont"))
		{
			document.getElementById("pres_dont").style.display = "none";
			document.getElementById("brandList").style.display = "";
			document.getElementById("viewBrandLink").style.display = "";
			document.getElementById("viewAllBrandLink").style.display = "none";
		}
	}else{
		document.getElementById("set_more_link").value = 0;
		document.getElementById("more_cat").style.display = "none";
		document.getElementById("brandList").style.display = "";
		document.getElementById("viewBrandLink").style.display = "";
		document.getElementById("viewAllBrandLink").style.display = "none";
		document.getElementById("backId").style.display = "";
		
		var newurl=document.getElementById("urlId").value+".html#a";
		window.location= newurl;
		
		
		if(document.getElementById("pres_dont"))
		{
			document.getElementById("pres_dont").style.display = "";
			document.getElementById("brandList").style.display = "none";
			document.getElementById("viewBrandLink").style.display = "";
			document.getElementById("viewAllBrandLink").style.display = "none";
		}
	}
}
function paging_submit(form_action,form_name)
{
	theForm = document.getElementById(form_name);
	theForm.action = form_action;
	theForm.submit();
}
function changeView(view_type,form_name) // for view changing
{
	theForm = document.getElementById(form_name);
	theForm.vi.value = view_type;
	theForm.submit();
}
function doPriceSort(sortField,form_name) //for paging script
{ 	
	theForm = document.getElementById(form_name);
	theForm.ps.value = sortField;
	theForm.submit();
}
function filltextbox(i)
{
	var qty = document.getElementById('qty_sel_'+i).value;
	if(isNaN(qty))
	{
		document.getElementById('qty_sel_'+i).style.display = 'none';
		document.getElementById('qty_'+i).style.display = '';
		document.getElementById('qty_'+i).value = '21';
	}
	else
	{
		document.getElementById('qty_'+i).value = qty;
	}
}

function filltextbox_search(i)
{
		
	var qty = document.getElementById('qty_sel_'+i).value;
	if(isNaN(qty))
	{
		document.getElementById('qty_sel_'+i).style.display = 'none';
		document.getElementById('qty_'+i).style.display = '';
		document.getElementById('qty_'+i).value = '21';
		showTotalPrice(i);
	}
	else
	{
		document.getElementById('qty_'+i).value = qty;
		showTotalPrice(i);
	}
}
/* Screen Resolution detection and set the variable for flash and div */
//to set dropdown position
var Left=0;
//alert(screen.width);
if(screen.width == 1088)
{
	image_name = 1024;
	width	   = 600;
	Left = 538;
}	
else if(screen.width == 1152)
{
	image_name = 1024;
	width	   = 600;
	Left = 602;
}	
else if(screen.width == 1280)
{
	image_name = 1200;
	width	   = 864;
	Left = 731;
}	
else if(screen.width >= 1300 && screen.width <= 1399)
{
	image_name = 1400;
	width	   = 1024;
	Left = 800;	
}	
else if(screen.width >= 1400 && screen.width <= 1499)
{
	image_name = 1400;
	width	   = 1024;
	Left = 900;	
}	
else if(screen.width >= 1600 && screen.width <= 1699)
{
	image_name = 1400;
	width	   = 1024;
	Left = 900;		
}	
else if(screen.width >= 1700 && screen.width <= 1799)
{
	image_name = 1400;
	Left = 1000;		
	Left = 1000;		
}	
else
{
	image_name = 1024;
	width	   = 600;
	Left = 473;
}	

/* Text block default change and search functions*/

function clearSearchField(objText)
{
	if(trimAll(objText.value) == "Search by title, author or ISBN")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Enter medicine name here")
	{
		objText.value='';
	}	
	else if(trimAll(objText.value) == "Enter Email Address")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Please Enter Your Name")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Please Enter Your Email")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Please Enter Your Review")
	{
		objText.value='';
	}
	objText.select();
}

function defaultText(objText)
{
	if(isWhitespace(objText.value))
	{
		objText.value='Search by title, author or ISBN';  	
	}
}

function TopSearch(keyword)
{
	document.getElementById('id_txt_search').value = keyword;
	document.frm_top_search.action = tmp_rootpath+"search_results.php";
	document.frm_top_search.submit();
}

function doSearch(objForm)
{
	if(document.getElementById('txt_search').value == 'Search by title, author or ISBN')
	{
		if(confirm("Please enter a title or keyword(s)"))
		{
			objForm.txt_search.value = "";
			objForm.txt_search.focus();
		}
		return false;
	}
	else if( document.getElementById('txt_search').value == '' )
	{
		alert('Please enter a title or keyword(s)');
		objForm.txt_search.value = "";
		objForm.txt_search.focus();
		return false;
	}
	else
	{
		objForm.submit();
	}
}
/* Preload images */
	function MM_preloadImages()
	{
		//v3.0
		var d = document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	MM_preloadImages(""+tmp_rootpath+"images/tabs/home.gif", ""+tmp_rootpath+"images/tabs/home_hover.gif", ""+tmp_rootpath+"images/tabs/browse_genres.gif", ""+tmp_rootpath+"images/tabs/browse_genres_hover.gif", ""+tmp_rootpath+"images/tabs/best_sellers.gif", ""+tmp_rootpath+"images/tabs/best_sellers_hover.gif", ""+tmp_rootpath+"images/tabs/bargain_books.gif", ""+tmp_rootpath+"images/tabs/bargain_books_hover.gif", ""+tmp_rootpath+"images/tabs/coming_soon.gif", ""+tmp_rootpath+"images/tabs/coming_soon_hover.gif",  ""+tmp_rootpath+"images/tabs/New_Releases.gif", ""+tmp_rootpath+"images/tabs/New_Releases_hover.gif", ""+tmp_rootpath+"images/tabs/recommendations.gif", ""+tmp_rootpath+"images/tabs/recommendations_hover.gif", ""+tmp_rootpath+"images/tabs/offers.gif", ""+tmp_rootpath+"images/tabs/offers_hover.gif", ""+tmp_rootpath+"images/favicon.ico");
	
	/*		MM_preloadImages(""+tmp_rootpath+"images/link_home_over.gif",""+tmp_rootpath+"images/link_prescriptions_over.gif",""+tmp_rootpath+"images/link_embarrassing_over.gif",""+tmp_rootpath+"images/link_medicines_over.gif",""+tmp_rootpath+"images/link_sexual_health_over.gif",""+tmp_rootpath+"images/link_health_over.gif",""+tmp_rootpath+"images/link_toiletries_new_over.gif",""+tmp_rootpath+"images/link_vitamins_over.gif",""+tmp_rootpath+"images/link_beauty_over.gif",""+tmp_rootpath+"images/link_for_men_over.gif",""+tmp_rootpath+"images/link_fragrances_over.gif",""+tmp_rootpath+"images/link_offers_new_over.gif",""+tmp_rootpath+"images/Loader.gif", ""+tmp_rootpath+"images/buttons/arrow_down.gif",""+tmp_rootpath+"images/link_baby_over.gif",""+tmp_rootpath+"images/link_electricals_over.gif",""+tmp_rootpath+"images/link_travel_over.gif",""+tmp_rootpath+"images/link_pets_new_over.gif",""+tmp_rootpath+"images/scholl_about.gif",""+tmp_rootpath+"images/scholl_about_over.gif",""+tmp_rootpath+"images/scholl_news_blogs.gif",""+tmp_rootpath+"images/scholl_news_blogs_over.gif",""+tmp_rootpath+"images/scholl_resource.gif",""+tmp_rootpath+"images/scholl_resource_over.gif",""+tmp_rootpath+"images/scholl_reviews.gif",""+tmp_rootpath+"images/scholl_reviews_over.gif",""+tmp_rootpath+"images/scholl_shop.gif",""+tmp_rootpath+"images/scholl_shop_over.gif",""+tmp_rootpath+"images/pop_up_bg.gif",
		
		""+tmp_rootpath+"images/tabs/home.gif", ""+tmp_rootpath+"images/tabs/home_hover.gif", ""+tmp_rootpath+"images/tabs/browse_genres.gif", ""+tmp_rootpath+"images/tabs/browse_genres_hover.gif", ""+tmp_rootpath+"images/tabs/best_sellers.gif", ""+tmp_rootpath+"images/tabs/best_sellers_hover.gif", ""+tmp_rootpath+"images/tabs/bargain_books.gif", ""+tmp_rootpath+"images/tabs/bargain_books_hover.gif", ""+tmp_rootpath+"images/tabs/coming_soon.gif", ""+tmp_rootpath+"images/tabs/coming_soon_hover.gif",  ""+tmp_rootpath+"images/tabs/New_Releases.gif", ""+tmp_rootpath+"images/tabs/New_Releases_hover.gif", ""+tmp_rootpath+"images/tabs/recommendations.gif", ""+tmp_rootpath+"images/tabs/recommendations_hover.gif", ""+tmp_rootpath+"images/tabs/offers.gif", ""+tmp_rootpath+"images/tabs/offers_hover.gif", ""+tmp_rootpath+"images/tabs/browse_subjects.gif", ""+tmp_rootpath+"images/tabs/browse_subjects_hover.gif",
		""+tmp_rootpath+"images/1.jpg", ""+tmp_rootpath+"images/2.jpg", ""+tmp_rootpath+"images/3.jpg"
		);
		*/


function getSelectedFieldValue(field_value)
{
	var ajaxRequest1;  // The variable that makes Ajax possible!
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest1 = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer Browsers
		try{
			ajaxRequest1 = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				ajaxRequest1 = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function()
	{
		if(ajaxRequest1.readyState == 4)
		{
			document.getElementById("frmSearchItems").innerHTML=""+ajaxRequest1.responseText+"";
			//document.getElementById("result").innerHTML="";
		}
	}
	var url = tmp_rootpath+"get_search_result.php?field_value="+field_value;
	ajaxRequest1.open("GET", url, true);
	ajaxRequest1.send(null); 
}

// START - For Roll over products //
function AjaxMoveProducts(type)
{
	try
	{ 
		// Opera 8.0+, Firefox, Safari
		xmlhttp = new XMLHttpRequest();
	}
	catch(e)
	{
		// Internet Explorer Browsers 
		try
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				// Something went wrong 
				alert("Your browser broke!"); 
				return false; 
			}
		}
	}

	if(type.length > 0)
	{
		var url = "ajax_products2.php";
		var param = "type="+type;
		xmlhttp.open('POST', url, true); 

		/* The Callback function */
		xmlhttp.onreadystatechange = function()
		{
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
				var objDetails = xmlhttp.responseText;
				if(objDetails != null)
				{
					document.getElementById('id_prd_list').innerHTML = objDetails;
				}				
			}
		}
		/* Send the POST request */
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.send(param);
		return false;
	}
}
// END - For Roll over products //

function change_view(val, frmName)
{
	var frmObj = document.getElementById(frmName);
	frmObj.hid_view.value = val;
	frmObj.submit();
}
function search_filter(val, frmName)
{
	if (val != "")
	{
		var frmObj = document.getElementById(frmName);
		frmObj.hid_sort.value = val;
		frmObj.submit();
	}
}
function monthFilterForComingSoon(val, frmName)
{	
	var frmObj = document.getElementById(frmName);
	frmObj.hid_CSmonth.value = val;
	frmObj.submit();	
}
function weekFilterForNewRelease(val, frmName)
{
	var frmObj = document.getElementById(frmName);
	frmObj.hid_NRweek.value = val;
	frmObj.submit();	
}
function fnRecPerPage(val, frmName)
{
	if (val != "")
	{
		var frmObj = document.getElementById(frmName);
		frmObj.hid_recPerPage.value = val;
		frmObj.submit();
	}
}

// ====================================== //
// ====================================== //
// include/validationscript/validatefunctions.js //
// ====================================== //
// ====================================== //


var whitespace = " \t\n\r";
function isEmpty(s)
{
   return ((s == null) || (s.length == 0))
}
function isWhitespace (s)
{  

	var i;
	// Is s empty?
	if (isEmpty(s)) return true;

	 // Search through string's characters one by one
	 // until we find a non-whitespace character.
	 // When we do, return false; if we don't, return true.
	 for (i = 0; i < s.length; i++)
	 {   
		 // Check that current character isn't whitespace.
		 var c = s.charAt(i);
 		
		 if (whitespace.indexOf(c) == -1) return false;
	 }
 
	 // All characters are whitespace.
	 return true;
}
function BuildStr(s, s1)
{
	  if (s.length> 0) s = s + "\n";
	  s = s + s1;
	  return s;
}

function isCharsInBag (s, bag)
{  
  var i;
  // Search through string's characters one by one.
  // If character is in bag, append to returnString.

  for (i = 0; i < s.length; i++)
  {   
	  // Check that current character isn't whitespace.
	  var c = s.charAt(i);
	  if (bag.indexOf(c) == -1) return false;
  }
  return true;
}

function echeck(str) 
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return true;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		return true;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return true;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return true;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return true;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return true;
	 }
	
	 if (str.indexOf(" ")!=-1){
		return true;
	 }

	 return false;					
}


function isEmail(string) 
{
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}

function validateUsername(loginName)
{
	//Validate the login name
	if (!isCharsInBag( loginName, "abcdefghijklmnopqrstuvwxyz0123456789.-_" ))
	{
		return "Login name has invalid characters.\n" ;
	}
	else if ( loginName.length < 3 )
	{
		return "Login name must be 3 or more characters.\n" ;
	}
	else
	{
		var count;
		for (count=0; count < loginName.length; count++)
		{
			if (loginName.charAt(count) == "_")
			{
				if (loginName.charAt(count+1) == "_")
				{
					return "Login name may not contain more than one consecutive underscore.\n";
				}
			}
		}
	}
	return "";
}


function monthno(mnth)
{
	getmonthno=13
	mnth=mnth.toLowerCase();
	switch(mnth)
	{
		case "jan": getmonthno = 1; break;
		case "feb": getmonthno = 2; break;
		case "mar": getmonthno = 3; break;
		case "apr": getmonthno = 4; break;
		case "may": getmonthno = 5; break;
		case "jun": getmonthno = 6; break;
		case "jul": getmonthno = 7; break;
		case "aug": getmonthno = 8; break;
		case "sep": getmonthno = 9; break;
		case "oct": getmonthno = 10; break;
		case "nov": getmonthno = 11; break;
		case "dec": getmonthno = 12; break;       
	}
	return getmonthno;				
}

function monthname(mnth)
{
	getmonthname=13
	mnth=mnth;
	switch(mnth)
	{
		case "01": getmonthname= "jan"; break;
		case "02": getmonthname= "feb"; break;
		case "03": getmonthname= "mar"; break;
		case "04": getmonthname= "apr"; break;
		case "05": getmonthname= "may"; break;
		case "06": getmonthname= "jun"; break;
		case "07": getmonthname= "jul"; break;
		case "08": getmonthname= "aug"; break;
		case "09": getmonthname= "sep"; break;
		case "10": getmonthname= "oct"; break;
		case "11": getmonthname= "nov"; break;
		case "12": getmonthname= "dec"; break;       
	}
	return getmonthname;				
}

function checkDates(paramStartDate, paramEndDate)
{
	
	dtfrom=paramStartDate;

	if(dtfrom!="")
	{
		dt1_s=dtfrom.split("-");
		dt1_d=dt1_s[0]	
		dt1_m=dt1_s[1]
		dt1_y=dt1_s[2]		
	}
	
	dtto=paramEndDate;

	if(dtto!="")
	{
		dt2_s=dtto.split("-");
		dt2_d=dt2_s[0]	
		dt2_m=dt2_s[1]
		dt2_y=dt2_s[2]		
	}
		
	
	var dteStart = new Date(dt1_y, dt1_m, dt1_d,0,0,0);
	var dteEnd = new Date(dt2_y, dt2_m, dt2_d,0,0,0);

	var dteCurrent = new Date();	

	if(dteStart.valueOf() - dteEnd.valueOf() > 0)
	{
	   	getvalno=0
	}
	else
	{
		getvalno=1;
	}
	return getvalno;				
}

function roundNumber(num, dec) 
{
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

function add_zeros(num, zeros) 
{
	// It will add trailing zeros
	if(zeros == undefined || zeros == null)
		zeros = 2;
		
	var result = num.toFixed(zeros); // result will equal 10.00
	return result;
}

function checknumeric(thefval,thestr)
{
	if(!isCharsInBag(thefval, thestr) || isNaN(thefval))
		{
			alert("Please enter numeric value");
			return false;
		}
}

function checksort(val)
{	
	if(isNaN(val))
	{
		alert("Please enter numeric value \n");
		this.focus();
	}
}

//validate allowed imagetype
function checkImageType(sImageName)
{	
	var imageFilename = trimAll(sImageName);	
	var imageExtention = "";
	var arrAllowedImageType = new Array();
	arrAllowedImageType[0] = "jpg";
	arrAllowedImageType[1] = "jpeg";
	arrAllowedImageType[2] = "png";
	
	//get image file TYPE
	var arrImageName = new Array();		
	arrImageName = imageFilename.split(".");		
	imageExtention = arrImageName[arrImageName.length-1];
	imageExtention = imageExtention.toLowerCase();
	var i;
	for (i=0; i < arrAllowedImageType.length; i++) 
	{
		if (arrAllowedImageType[i] == imageExtention) 
		{
			return true;
		}
	}
	return false;
}


//validate allowed imagetype
function checkLogoType(sImageName)
{	
	var imageFilename = trimAll(sImageName);	
	var imageExtention = "";
	var arrAllowedImageType = new Array();
	arrAllowedImageType[0] = "jpg";
	arrAllowedImageType[1] = "jpeg";
	arrAllowedImageType[2] = "gif";
	
	//get image file TYPE
	var arrImageName = new Array();		
	arrImageName = imageFilename.split(".");		
	imageExtention = arrImageName[arrImageName.length-1];
	imageExtention = imageExtention.toLowerCase();
	
	var i;
	for (i=0; i < arrAllowedImageType.length; i++) 
	{
		if (arrAllowedImageType[i] == imageExtention) 
		{
			return true;
		}
	}
	return false;
}


/* Increase textarea rows as user puts content - Toreduse overall page height so make userfriedly */
function textAreaRowsHeight(field,linelimit,textmaxlimit) 
{
	textCounter(field,textmaxlimit);
	LineHeight =20;
	var enterKeyEvent = field.value.split('\n').length
	if (field.value.length > linelimit || enterKeyEvent>1) // if too long...trim it!
	{
		//alert(enterKeyEvent);
		var rows_req=enterKeyEvent+Math.ceil(field.value.length/linelimit);
		LineHeight -= rows_req;
		var height_req=parseInt(rows_req)*15;
		field.style.height = height_req;
		//field.style.scrolling='no';
		field.rows = rows_req;
	}
	else
	{
		field.style.height = "20";
		field.rows = 1;
	}
}

/*function textAreaRowsHeight(field,linelimit,textmaxlimit) 
{
	//alert(field);
	alert(field.value.length);
	textCounter(field,textmaxlimit);
	LineHeight =20;
	if (field.value.length > linelimit) // if too long...trim it!
	{
		var rows_req=Math.ceil(field.value.length/linelimit);
		LineHeight -= rows_req;
		var height_req=parseInt(rows_req)*LineHeight;
		field.style.height = height_req+"px;";
		field.rows = rows_req;		
	}
	else
	{
		field.style.height = "20px;";
		field.rows = 1;
	}
}*/

/* checks max character length for textarea */
function textCounter(field, maxlimit) 
{
	if (field.value.length > maxlimit) // if too long...trim it!
	{
		alert("You can not enter more than "+maxlimit+" characters");
		field.value = field.value.substring(0, maxlimit);
	}
}

function trimAll(sString) 
{
	if(!isEmpty(sString))
	{
		while (sString.substring(0,1) == ' ' || sString.substring(0,1) == '\n' || sString.substring(0,1) == '\r' || sString.substring(0,1) == '\t')
		{
			sString = sString.substring(1, sString.length);
		}
		while (sString.substring(sString.length-1, sString.length) == ' ' || sString.substring(sString.length-1, sString.length) == '\n' || sString.substring(sString.length-1, sString.length) == '\r' || sString.substring(sString.length-1, sString.length) == '\t')
		{
			sString = sString.substring(0,sString.length-1);
		}
	}
	return sString; 
}

function doAdminPost(page,theForm) //for paging script
{ 	
	document.all.page.value = page;
	theForm.submit();
}

function doAdminSearch()
{
	//alert(document.all.letter);	
	if(document.all.letter != undefined)
		document.all.letter.value='';
	if(document.all.page != undefined)
		document.all.page.value=1;		
	if(document.all.search != undefined)
		if(document.all.search.value == 'Enter keyword(s)') { document.all.search.value='';}
	
	document.all.page.value = 1;
}

function showpopup(val,filedName) //Date POPup
{
	popUpCalendar(val, filedName, "mm/dd/yyyy");
}

function doProductList(page,theForm) //for paging script
{ 	
	theForm.method = 'GET';
	//theForm.event_page.value = event_page;
	//if(document.all.page != 'undefined')	document.all.page.value = page;
	theForm.submit();
}
function doPriceSort(sortField) //for paging script
{ 	
	theForm = document.form1;
	theForm.ps.value = sortField.value;
	theForm.method = 'GET';
	theForm.submit();
}
function doSearchFilter(sortField,form_name) //for product listing sort script
{	
	theForm = document.getElementById(form_name);
	//if(theForm.page != 'undefined') theForm.page.value = 1;
	//theForm.p_sort.value = document.all(sortField).value;
	theForm.ps.value = document.getElementById(sortField).value;
	//theForm.p_filter.value = document.all(filterField).value;
	theForm.submit();
}

function ShowMeEverithingSearch(sortField, filterField) //for product listing sort script
{	
	theForm = document.form1;
	//theForm = document.getElementById(form_name);
	theForm.ps.value = document.getElementById(sortField).value;
	theForm.ps_filter.value = document.getElementById(filterField).value;
	theForm.method = 'get';
	theForm.submit();
}
function validateSearch(theForm)
{
	theForm.q.value = document.all('txtsearch').value;
	if(isWhitespace(theForm.q.value) || theForm.q.value == "Enter keyword(s) or Product Code")
	{
		theForm.q.value = "";
		theForm.q.focus();
	}
	return true;
}

//IT AUTO SELECTS VALUE OF DROPDOWN BASED ON SEARCH VALUE PASSED TO IT
//IT COMPARES DROPDOWN VALUE AND NOT TEST
function selectdatabasevalue(toselect,cmb)
{
	for(i=0;i<eval(cmb).length;i++)
	{
		if(eval(cmb).options[i].value==toselect)
		{
			eval(cmb).selectedIndex = i;
		}
	}
}

function URLEncode(objSource)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = objSource.value;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
		if (ch == " ") {
			encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
			encoded += ch;
		} else {
			var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				alert( "Unicode Character '" 
						+ ch 
						+ "' cannot be encoded using standard URL encoding.\n" +
						  "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	//objDest.value = encoded;
	return encoded;
}


/* DATE VALIDATION SCRIPTS --- START --- */
// Declaring valid date character, minimum year and maximum year
//it validates date in MM/DD/YYYY Format
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr,dtSep){
	var daysInMonth = DaysArray(12)
	
	if(dtSep != null)
		if(dtSep.length > 0) dtCh = dtSep;	
	
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		//The date format should be : mm/dd/yyyy
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		//Please enter a valid month
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//Please enter a valid day"
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//Please enter a valid 4 digit year between "+minYear+" and "+maxYear
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//Please enter a valid date
		return false;
	}
return true
}

/* DATE VALIDATION SCRIPTS --- END --- */


var zzz=0;
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
	if(zzz==1) { opacStart=30; opacEnd=100; }

	var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
	zzz++;	if(zzz==2) zzz=0;
	//alert(zzz);
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

// ====================================== //
// ====================================== //
// include/validationscript/shoppingcart.js //
// ====================================== //
// ====================================== //
/*-----------------------------------------------------------------------
Created by: Rajendra
Created date: 16 Oct 2008
File description: Shopping Cart Javascript Functions to Add/Update/Remove product from shopping cart
Special instructions-notes:Java script
Tables used: none
Stored procedures: none
Triggers used: none
-----------------------------------------------------------------------*/
function RemoveFromCart( action, item_id )
{
	var tmp_rootpath_div = tmp_rootpath.replace("registration/","");
	var conf = confirm( "Do you really want to remove an item?" );
	if( conf )
	{
		document.frmcart1.hidn_item_count.value = item_id;
		document.frmcart1.hidn_cart_action.value = 'REMOVE';
		document.frmcart1.action = tmp_rootpath+"shopping_cart.php";
		document.frmcart1.submit();
	}
}

function UpdateFromCart( action, item_id )
{
	var tmp_rootpath_div = tmp_rootpath.replace( "registration/", "" );
	var conf = confirm( "Do you really want to update item quantity?" );
	if( conf )
	{
		document.frmcart1.hidn_item_count.value = item_id;
		document.frmcart1.hidn_cart_action.value = 'UPDATE';
		document.frmcart1.action = tmp_rootpath+"shopping_cart.php";
		document.frmcart1.submit();
	}
}

function applyPromo(url)
{
	if( url == 'shopping_cart' )
	{
		var page_url = 'shopping_cart.php';
	}
	else if( url == 'shopping_cart_prescription' )
	{
		var page_url = 'shopping_cart_prescription.php';
	}
	else if( url == 'shopping_cart_auto_delivery' )
	{
		var page_url = 'shopping_cart_auto_delivery.php';
	}
	
	if(isWhitespace(document.getElementById('pcode').value))
	{
		alert("Enter Promotion Code");		
	}
	else
	{
		document.frm_data.hid_promo_code.value = document.getElementById('pcode').value;
		document.frm_data.action = tmp_rootpath + page_url;
		document.frm_data.submit();
	}	
}

function removePromo(url)
{
	if( url == 'shopping_cart' )
	{
		var page_url = 'shopping_cart.php';
	}
	else if( url == 'shopping_cart_prescription' )
	{
		var page_url = 'shopping_cart_prescription.php';
	}
	else if( url == 'shopping_cart_auto_delivery' )
	{
		var page_url = 'shopping_cart_auto_delivery.php';
	}
	document.frm_data.hid_promo_apply.value = '-1';
	document.frm_data.action = tmp_rootpath + page_url;
	document.frm_data.submit();
}

function empty_basket(url)
{
	if( url == 'shopping_cart' )
	{
		var page_url = 'shopping_cart.php';
	}
	else if( url == 'shopping_cart_prescription' )
	{
		var page_url = 'shopping_cart_prescription.php';
	}
	else if( url == 'shopping_cart_auto_delivery' )
	{
		var page_url = 'shopping_cart_auto_delivery.php';
	}
	
	document.frm_data.hid_custom.value = 'empty';
	document.frm_data.action = tmp_rootpath + page_url;
	document.frm_data.submit();
}

function removeAutoDelivery(id)
{
	document.frm_data.hid_custom.value = 'remove_ad';
	document.frm_data.hid_custom_1.value = id;
	document.frm_data.action = "shopping_cart_auto_delivery.php";
	document.frm_data.submit();
}
// Code For Get MOUSE POSITION
var IE = document.all?true:false
if (!IE){ document.captureEvents(Event.MOUSEMOVE);}
document.onmouseup = getMouseXY;
function getMouseXY(e) {
	var tempX = 0;
	var tempY = 0;	
	if (IE) { 
		if(document.documentElement){
			tempX = event.clientX + document.documentElement.scrollLeft;
			tempY = event.clientY + document.documentElement.scrollTop;
		}else{
			tempX = event.clientX + document.body.scrollLeft;
			tempY = event.clientY + document.body.scrollTop;
		}
	} else { 
		tempX = e.pageX
		tempY = e.pageY
	}  
	if (tempX < 0){tempX = 0}
	if (tempY < 0){tempY = 0}
	
	var mousePosition = "0,0";
	if(tempX>0 && tempY>0){
		mousePosition = tempX+","+tempY;		
	} 	
	if(document.getElementById("MouseXY")){		
		document.getElementById("MouseXY").value = mousePosition;
	}	
	return true
}
function doCart(action, product_id, div_id, y, w, h, url )
{
	var Left=0;
	if(document.getElementById("MouseXY")){		
		var mousePosition = document.getElementById("MouseXY").value;
	}else{		
		var mousePosition = "";	
	}	
	
	
	if(mousePosition!="")
	{
		var tmpXYArray = mousePosition.split(',');		
		var mouseXpos = parseInt(tmpXYArray[0]);
		var mouseYpos = parseInt(tmpXYArray[1]);
		if(mouseXpos>0 && mouseYpos>0){				
			Left = parseInt(mouseXpos)-100;
			y	 = parseInt(mouseYpos)-500;	
		}	
	}
	//alert("X="+Left+"\nY="+y); return false;
	//alert(product_id);
	Left = 700;
	y = 10;
	var tmp_rootpath_div = tmp_rootpath.replace("registration/","");
	var xmlHttp;
	if( document.getElementById('qty_1') )
		var qty_sel = document.getElementById('qty_1').value;
	else	
		var qty_sel = '';

	xmlHttp = GetXmlHttpObject()
	if ( xmlHttp == null )
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var url = tmp_rootpath_div+'do_cart.php?cart_action='+action+'&product_id='+product_id+'&quantity='+qty_sel+'&setCartFlg=1';	

	xmlHttp.onreadystatechange = stateChanged
	xmlHttp.open( 'GET', url, true )
	xmlHttp.send( null );
	function stateChanged()
	{
		if ( xmlHttp.readyState == 4 || xmlHttp.readyState == "complete" )
		{
			var objDetails = xmlHttp.responseText;
			
			//alert( objDetails );
			var ajax_response = objDetails.split('_');
			alert_msg = ajax_response[1];
			var basket_qty = ajax_response[2];
			var basket_tot_price = parseFloat(ajax_response[3]).toFixed(2);

			document.getElementById('div_show_cart').innerHTML = '<a href='+tmp_rootpath+'shopping_cart.php>View Basket ('+basket_qty+') | &pound;&nbsp;'+basket_tot_price+'</a>';
			
			//alert(objDetails.substr(0,5000));

			putIF( 'bubble_div', Left, y, w, h, '', alert_msg );
			window.scrollTo(0,0);
		}
	}
	function GetXmlHttpObject()
	{
		var objXMLHttp = null
		if ( window.XMLHttpRequest )
		{
			objXMLHttp = new XMLHttpRequest()
		}
		else if ( window.ActiveXObject )
		{
			objXMLHttp = new ActiveXObject( "Microsoft.XMLHTTP" )
		}
		return objXMLHttp;
	}	
}

function pres_doCart(action, itemid)
{
	var proceed = 1;
	var cart_form = document.frmcart;
	if (!isWhitespace(action) && !isWhitespace(itemid))
	{
		var pid=document.getElementById('pid_'+itemid).value;		
		var qty=document.getElementById('qty_'+itemid).value;
		var to_id = 0;
		if(document.getElementById('to_id_'+itemid))		//to_id_ is Temp Order ID
		{
			to_id=document.getElementById('to_id_'+itemid).value;
		}
		
		//if Action is to Add/Update a cart listing then validate qty else 
		//if user want to remove an item from cart then no need to validate qty field
		if(action != 'REMOVE')
		{
			if(!validateQty(qty))
			{
				proceed = 0;
			}
		}
			
		if(proceed == 1)
		{
			cart_form.action = "pres_do_cart.php";
			cart_form.cart_action.value = action;
			cart_form.cart_pid.value = pid;
			cart_form.cart_qty.value = qty;
			cart_form.to_id.value = to_id;
			cart_form.submit();
		}
	}
}

function pres_doCartnew(action, itemid)
{
	var proceed = 1;

	if ((action=='ADD')&&(itemid>0))
	{
		
		cart_form = document.frmcart;
		var pid=document.getElementById('pid_'+itemid).value;		
		var qty=document.getElementById('qty_'+itemid).value;
		var to_id = 0;
		if(document.getElementById('to_id_'+itemid))		//to_id_ is Temp Order ID
		{
			to_id=document.getElementById('to_id_'+itemid).value;
		}		
		
		
		//if Action is to Add/Update a cart listing then validate qty else 
		//if user want to remove an item from cart then no need to validate qty field
		if(action != 'REMOVE')
		{
			if(!validateQty(qty))
			{
				proceed = 0;
			}
		}
		if(proceed == 1)
		{
			
			cart_form.action = "pres_do_cart.php";
			cart_form.cart_action.value = action;
			cart_form.cart_pid.value = pid;
			cart_form.cart_qty.value = qty;
			cart_form.to_id.value = to_id;

			cart_form.submit();
		}
	}
}
function validateQty(qty)
{	
	if(isWhitespace(qty))
	{
		alert("Please Enter Quantity");
		return false;
	}
	else if(qty==0)
	{
		alert("Product Quantity can not be 0");
		return false;
	}
	else if(!isCharsInBag(qty,"0123456789"))
	{
		alert("Enter Only Numeric Value for Quantity");
		return false;
	}
	return true;
}

function remove_wl(itemid)
{
	if (confirm('Do you really want to remove this product?'))
	{
		var pid = document.getElementById('pid_'+itemid).value;
		document.frmremovewl.wl_pid.value = pid;
		document.frmremovewl.action = "do_wishlist.php";
		document.frmremovewl.submit();
	}
}
function negvalue()
{
	
	var qty = document.getElementById('qty_1').value;
	if(isNaN(qty))
	{
		alert("Enter Only Numeric Value for Quantity");
	}
}

function check_pet_practitioner()
{
	if(document.pet_prodcut.uk_practitioner)
	{
		if(document.pet_prodcut.uk_practitioner.checked != true)
		{
			alert("Please confirm you have or intend to obtain a prescription signed by a Vet. We cannot supply prescription medicine without one.");
			document.pet_prodcut.uk_practitioner.focus();
			//document.focus('uk_practitioner');
			return false;
		}
		else
		{
			document.pet_prodcut.submit(); 
			return true;	
		}
	}
	else
	{
		document.pet_prodcut.submit(); 
		return true;
	}	
	//return false;
}
// ====================================== //
// ====================================== //
// include/validationscript/swfobject.js //
// ====================================== //
// ====================================== //

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

// ====================================== //
// ====================================== //
// include/validationscript/div_popup.js //
// ====================================== //
// ====================================== //

/*-----------------------------------------------------------------------
Created by: Ketan
Created date: 16 July 2007
File description: Shopping Cart Javascript Functions to Add/Update/Remove product from shopping cart
Special instructions-notes:Java script
Tables used: none
Stored procedures: none
Triggers used: none
-----------------------------------------------------------------------*/
var IE = document.all?true:false
if (!IE)
{
	document.captureEvents(Event.MOUSEMOVE)
}
function putIF( hldr, x, y, w, h, url, sc_alert_msg )      // description of the arguments below
{
	holder = document.getElementById(hldr); //wrap around div
	/*if (!IE)
	{
		holder.style.right = "565px";
		holder.style.top = "15px";
	}
	else
	{
		holder.style.right = "215px";
		holder.style.top = "15px";
	}	
	holder.style.visibility = 'visible';*/	
	if(navigator.appName == 'Microsoft Internet Explorer')
	{
		if(navigator.appVersion.indexOf('MSIE 6.0')>0){			
			holder.style.right = "235px";
		}else{			
			holder.style.right = "565px";
		}
	}else{		
		holder.style.right = "565px";		
	}
	holder.style.top = "15px";
	holder.style.visibility = 'visible';
	
	IF = document.createElement('div');	
	IF.setAttribute("scrolling", 'no');
	holder.appendChild(IF); // now we add it to the div
	//holder.innerHTML+='<div id="div_tab" align="center" style="width: "+w+"px; float: left;"><img src="<?=$site_url?>images/basket_icon.jpg" alt="Basket"><br><span style="color: #192A6A; font-weight:bold; font-family: Arial, Helvetica, sans-serif;">'+sc_alert_msg+'</span><br><img src="<?=$site_url?>images/buttons/back_to_shop.gif" style="cursor:pointer;" alt="Continue shopping" onclick="closeIF()">&nbsp;<img src="<?=$site_url?>images/buttons/continue_checkout1.gif" style="cursor:pointer;" alt="Checkout" onclick="closeCO()"></div>';
	var tmp_rootpath_div = tmp_rootpath.replace("registration/","");

	holder.innerHTML = '<div id="div_tab" style="width:360px;"><div class="floatl" style="background-image:url('+tmp_rootpath_div+'images/Popup_Cart.gif); background-repeat:no-repeat; width:370px; height:192px;"><table width="300" border="0" cellspacing="0" cellpadding="0" id="popup" summary="" background="#00000;" align="left"><tr><td width="12" valign="top" >&nbsp;</td><td width="279" valign="top"><div align="right" class="text11grey padt8"><a href="javascript:closeIF();" class="botlink">Close</a><img src="'+tmp_rootpath_div+'images/tspacer.gif" height="1" width="3"/><a href="javascript:closeIF();"><img src="'+tmp_rootpath_div+'images/icon_close.gif" alt="Close" width="13" height="12" hspace="2" border="0" align="absmiddle" /></a></div><div align="center"></div><BR><BR><div align="center" class="text12 padt30">'+sc_alert_msg+'</div><div align="center" class="padt10"><img src="'+tmp_rootpath_div+'images/buttons/check_out.gif" alt="Checkout"  hspace="2" vspace="5" border="0" style="cursor:pointer;"  onclick="closeCO();" /><img src="'+tmp_rootpath_div+'images/tspacer.gif" height="1" width="5"/><img src="'+tmp_rootpath_div+'images/buttons/continue_shopping.gif" alt="Continue Shopping" hspace="2" vspace="5" border="0" style="cursor:pointer;" onclick="closeIF()" /></div></td><td width="9" align="right" valign="top" >&nbsp;</td></tr><tr><td colspan="3"  height="11">&nbsp;</td></tr> </table></div></div>';
// final step is to put in additional controls
}

function closeIF() // the close is simple we just clear out the div
{
	var obj = document.getElementById('bubble_div');
	obj.innerHTML='';
	//obj.style.display='none';
}

function closeCO() // the close is simple we just clear out the div
{

	if(tmp_rootpath.indexOf('registration')>0)
	{
		var tmp_rootpath_div = tmp_rootpath.replace("registration/","");
		PageFrom	= tmp_rootpath_div+"shopping_cart.php";
	}
	else
	{
		PageFrom	= tmp_rootpath+"shopping_cart.php";
	}
	var obj = document.getElementById('bubble_div');
	obj.innerHTML='';
	//obj.style.display='none';
	document.location.href = PageFrom;
}

