//Duncan Hart . duncan.hart@dhinteractive.co.uk . http://www.dhinteractive.co.uk

//***************************************************************************//
// QueryString Access
function QueryString(key){
var value = null;
for (var i=0;i<QueryString.keys.length;i++){
if (QueryString.keys[i]==key){
value = QueryString.values[i];
break;
}
}
return value;
}

QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse(){
var query = window.location.search.substring(1);
var pairs = query.split("&");
	
for (var i=0;i<pairs.length;i++){
var pos = pairs[i].indexOf('=');
if (pos >= 0){
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);

QueryString.keys[QueryString.keys.length] = argname;
QueryString.values[QueryString.values.length] = value;

var languagecode = pairs[0]+"&"+pairs[1];
}
}

return languagecode;
}

var languagecode = QueryString_Parse();
//***************************************************************************//



//***************************************************************************//
// Dropdown Auto refresh
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='index.php?action=dropdown&section="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto refresh [ Links ]
function linksautorefresh(targ,selObj, restore, url){ //v3.0
eval(targ+".location='"+url+"&links_section_id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto refresh [ Picture Section ]
function pictureautorefresh(targ,selObj, restore, url){ //v3.0
eval(targ+".location='"+url+"&picture_section_id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function individualautorefresh(targ,selObj, restore, url){ //v3.0
eval(targ+".location='"+url+"&individual_section_id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function cmtpictureautorefresh(targ,selObj, restore, url){ //v3.0
eval(targ+".location='"+url+"&id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto refresh [ Scheme Finder Areas ]
function schemefinderautorefresh(targ,selObj, restore, url){ //v3.0
eval(targ+".location='"+url+"&area_id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto refresh [ Microsites ]
function micrositeautorefresh(targ,selObj, restore, url){ //v3.0
eval(targ+".location='"+url+"&area_id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto refresh [ Microsites ]
function microsite_cmt(targ,selObj, restore, url){ //v3.0
eval(targ+".location='index.php?section="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//


//***************************************************************************//
// Javascript Error Prompts
function confirmdeleterecord(action, id, section, additionalstring){

// Publications
if(section == "publications"){
var msg = "Are you sure you want to delete this record?";
}

// shop
if(section == "shop"){
var msg = "Are you sure you want to delete this record?";
}

// Vacancies
if(section == "vacancies"){
var msg = "Are you sure you want to delete this record?";
}

// Testimonials
if(section == "testimonials"){
var msg = "Are you sure you want to delete this record?";
}

// Picture Section
if(section == "pictures"){
var msg = "Are you sure you want to delete this record?";
}

// Association News Section
if(section == "associationnews"){
var msg = "Are you sure you want to delete this record?";
}

// Carers Stories
if(section == "carerstories"){
var msg = "Are you sure you want to delete this record?";
}

// Carers Week
if(section == "carersweek"){
var msg = "Are you sure you want to delete this record?";
}

// Press Section
if(section == "press"){
var msg = "Are you sure you want to delete this record?";
}

// Press Section
if(section == "events"){
var msg = "Are you sure you want to delete this record?";
}

// Partnership Working
if(section == "partnerships"){
var msg = "Are you sure you want to delete this record?";
}

// Schemes Finder Section
if(section == "scheme"){
var msg = "Are you sure you want to delete this record?";
}

if(confirm(msg)){
top.location="index.php?id="+id+"&section="+action+"&reload="+section+"&"+additionalstring;
}


}
//***************************************************************************//

//***************************************************************************//
// Submit a form into a Popup
function popupform(myform, windowname, url){

if(! window.focus) return true;
popupwindow(url,windowname,'650','600','cscreen','50','50','yes','yes','yes','0','yes','0')
myform.target=windowname;
return true;

}
//***************************************************************************//



