function load(){
	var objFrame=document.getElementById("page");
	
	if(objFrame){
		var x=requestValue("pname");
		var y=requestValue("store");
		var w=requestValue("offer");
		var z=("&store="+y+"&offer="+w);
		objFrame.src="http://www.specsavers.ie/cgi-bin/strudwick.sh/s?langid=1&pfmt=1&siteid=51&pname="+x+".html"+z;
	}
}

function requestValue(variable){
	return document.getElementById(variable).value;
}

function requestQuery(variable){
	var url=window.location.search.substring(1);
	var query = url.split("&"); 
	for (var i=0;i<query.length;i++) {
	    var pair = query[i].split("="); 
	    if (pair[0] == variable) {
	        return (pair[1]);
        }
    }
}

function page_form(v,j){


   if(v==1){
   document.getElementById("startP").disabled=false;
   document.getElementById("p_fP").disabled=false;
   }
   
   if(v==2 ){
   document.getElementById("startN").disabled=false;
   document.getElementById("p_fN").disabled=false;
   }
   
  
	
   if(v==3){
   document.getElementById("startF").disabled=false;
   document.getElementById("p_fF").disabled=false;
     
   }
   
   if(v==4){
   document.getElementById("startB").disabled=false;
   document.getElementById("p_fB").disabled=false;

   }
      
   if(v==5){

   document.getElementById("startM"+j).disabled=false;
   document.getElementById("p_fM"+j).disabled=false;
       
   }

	document.getElementById("form_name").submit();
}

function product_detail_submit(v){
	var formname='product_details_form'+v;
	document.getElementById(formname).submit();
}

function product_detail_back(){
	document.back_product_detail.submit();
}

// Store related scripts starts here
function storehome(){
	document.storehome.submit();
}

function bookAppointment (){
	document.bookAppointment.submit();
}

function findStoresByRegionNo(region_no){
	document.region.region_no.value=region_no;
	document.region.submit();
}

function viewAllOffers (){
	document.viewAllOffers.submit();
}

function findStoreOfferById(url, offer_id){
	document.storeoffer.action=url;	
	document.storeoffer.offer_id.value=offer_id;
	//document.storeoffer.offer.value=offer;
	document.storeoffer.submit();
}

function findStoreOnlyOfferById(url, offer_id, offer){
	document.storeonlyoffer.action=url;	
	document.storeonlyoffer.offer_id.value=offer_id;
	document.storeonlyoffer.offer.value=offer;
	document.storeonlyoffer.submit();
}

function viewAllNews (){
  	document.viewAllNews.submit();
}

//deprecated, only url is sufficient
function findStoreNewsById(url,news_id){
	document.storenews.action=url;
	document.storenews.news_id.value=news_id;
	//document.storenews.news.value=news;
	document.storenews.submit();
}

function findStoreTestimonialsById(url,testimonials_id){
	document.storetestimonials.action=url;
	document.storetestimonials.testimonials_id.value=testimonials_id;
	//document.storenews.news.value=news;
	document.storetestimonials.submit();
}

//deprecated, only url is sufficient
function showSpecialOfferById(url,offer_id){
	document.specialoffer.action=url;
	document.specialoffer.offer_id.value=offer_id;
	document.specialoffer.submit();
}


// Store related scripts ends here

// copied from application.js
function popup(url, customWidth, customHeight)
{
	//get widths and heights of the visitors screen
	var leftPos = (screen.width - customWidth) / 2;
	var topPos = ((screen.height - customHeight) / 2);
 
	newWindow = window.open(url, "popup", "location=0, status=0, resizable=1, scrollbars=1, width="+ customWidth + ", height=" + customHeight + ", top=" + topPos + ", left=" + leftPos);
	newWindow.window.focus();
}

function funSubmit(designerBrand,frmAction){
	document.frmDesigner.action = frmAction+"designer";
	document.frmDesigner.brand.value=designerBrand;
	document.frmDesigner.price.value="125";
	document.frmDesigner.submit();
}

 function findCorporateNewsById(url,news_id){
	document.corporatenews.action=url;
	document.corporatenews.news_id.value=news_id;
	document.corporatenews.submit();
}

function reOrder(){
		var retvalue = confirm(IF_YOU_CONTINUE_REPEAT_ORDER);	
		if(!retvalue){
			return false;
		}
}

function clear_default_value(id){
	if(document.getElementById(id).value == document.getElementById(id).getAttribute('defaultValue')){
		document.getElementById(id).value = "";
	}
	return (false);
}

function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}